typeahead.js icon indicating copy to clipboard operation
typeahead.js copied to clipboard

Function isMsie does not work in IE11

Open nathankoop opened this issue 12 years ago • 4 comments

The function isMsie does not accurately reflect Internet Explorer 11 as IE.

This likely causes several issues, one being that the Close event fires before the Selected event

nathankoop avatar Dec 13 '13 16:12 nathankoop

Does this solve the problem ? isMsie: function() { return /(msie|trident)/i.test(navigator.userAgent); } I can't test this my self since the latet secuity update of windows 8.1 rendered my IE useless :-(

Svakinn avatar Dec 17 '13 12:12 Svakinn

The function needs to return the version number (EG: 7, 8..11)

I used:

isMsie: function () {
            var rv = -1;
            if (navigator.appName == 'Microsoft Internet Explorer') {
                var ua = navigator.userAgent;
                var re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
                if (re.exec(ua) != null)
                    rv = parseFloat(RegExp.$1);
            }
            else if (navigator.appName == 'Netscape') {
                var ua = navigator.userAgent;
                var re = new RegExp("Trident/.*rv:([0-9]{1,}[\.0-9]{0,})");
                if (re.exec(ua) != null)
                    rv = parseFloat(RegExp.$1);
            }
            return rv;
        }

this is from http://stackoverflow.com/questions/17907445/how-to-detect-ie11

nathankoop avatar Dec 17 '13 14:12 nathankoop

Aha great. bower.js https://github.com/ded/bowser/blob/master/bowser.js has a shorter version that could be applied here like:

isMsie: function() { return /(msie|trident)/i.test(navigator.userAgent) ? navigator.userAgent.match(/(msie |rv:)(\d+(.\d+)?)/i)[2] : false; }

However.. did the IE11 detection improuval solve the problem with dropdown click selection issue https://github.com/twitter/typeahead.js/issues/554 ?

Svakinn avatar Dec 17 '13 20:12 Svakinn

The fix to isMsie did resolve the issue with the event firing incorrectly.

I'll have to check to see if it resolves #554 (will have to wait until tomorrow unfortunately)

nathankoop avatar Dec 17 '13 21:12 nathankoop