2013-02-06 32 views

回答

4
if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)){ //test for MSIE x.x; 

if (/Firefox[\/\s](\d+\.\d+)/.test(navigator.userAgent)){ //test for Firefox 

Read more in-depth here

注意,它通常是更好地檢測功能不是瀏覽器,你不應該關心,因爲它支持你的功能,最終用戶只要使用的瀏覽器。