What is the correct way to detect Opera using jQuery?

前端 未结 9 1699
梦毁少年i
梦毁少年i 2021-02-19 04:52

Amazon.com recently updated their javascript, and it\'s causing problems with some Opera browsers.

Their browser detection code looks like so, but it\'s faulty:

9条回答
  •  名媛妹妹
    2021-02-19 05:33

    It is much better to detect javascript capabilities rather than browser userAgent.

    ie DOM, XmlHttpRequest, eventing model (event.target vs event.srcElement), ActiveX, Java etc

    By focusing on the API functions that you will require, rather than a target browser you will create a more robust set of scripts, and inevitably less special casing.

    This link here at opera will probably tell you more

提交回复
热议问题