Check if user is using IE

后端 未结 30 1550
心在旅途
心在旅途 2020-11-22 04:34

I am calling a function like the one below by click on divs with a certain class.

Is there a way I can check when starting the function if a user is using Internet

30条回答
  •  礼貌的吻别
    2020-11-22 05:03

    This is how the Angularjs team is doing it (v 1.6.5):

    var msie, // holds major version number for IE, or NaN if UA is not IE.
    
    // Support: IE 9-11 only
    /**
     * documentMode is an IE-only property
     * http://msdn.microsoft.com/en-us/library/ie/cc196988(v=vs.85).aspx
     */
    msie = window.document.documentMode;
    

    Then there are several lines of code scattered throughout using it as a number such as

    if (event === 'input' && msie <= 11) return false;
    

    and

    if (enabled && msie < 8) {
    

提交回复
热议问题