browser-detection

Easiest/Lightest Replacement For Browser Detection jQuery 1.9?

断了今生、忘了曾经 提交于 2019-12-17 15:35:38
问题 I had several clients complain yesterday that some code stopped working. Apparently it comes down to plug-ins using the now deprecated jQuery.browser which stopped working yesterday when jQuery 1.9 was released. I (quickly) looked at the 1.9 change docs and it seems like they want me to substitute some pretty heavy libraries just for that one function. Is there a recommended lightest weight plug-in or code snippet to restore that functionality? For what these sites need, it's very basic; I

How to detect IE 11 with javascript in Asp.net

自闭症网瘾萝莉.ら 提交于 2019-12-17 08:59:12
问题 Hello I want to detect the Browser , IE 8 or more will be appropriate for me. For this i used following code but it fails for IE 11 . For other its detecting properly. function getInternetExplorerVersion() { var rv = -1; // Return value assumes failure. 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); } return rv; } Below is the link which also I

If Browser is Internet Explorer: run an alternative script instead

╄→гoц情女王★ 提交于 2019-12-17 06:39:33
问题 I'm using an image carousel script that is quite heavy on the browser. It works great in Opera and Chrome, half decent in FF and absolutely breaks my balls in IE. So i'd like to give IE users an alternative of simple HTML without any action/JS. The script doesn't use MT or jQuery and its like 380 lines of JS. Would it be possible to give IE users a plain HTML alternative? var browserName=navigator.appName; if (browserName=="Microsoft Internet Explorer") { // what command can i use? } 回答1:

Best way to check for IE less than 9 in JavaScript without library

孤街醉人 提交于 2019-12-17 06:24:31
问题 What would be your fastest, shortest (best) way to detect browser which is IE and version less than 9 in JavaScript, without using jQuery or any add-on libraries? 回答1: Javascript var ie = (function(){ var undef, v = 3, div = document.createElement('div'), all = div.getElementsByTagName('i'); while ( div.innerHTML = '<!--[if gt IE ' + (++v) + ']><i></i><![endif]-->', all[0] ); return v > 4 ? v : undef; }()); You can then do: ie < 9 By James Panolsey from here: http://james.padolsey.com

Detect Safari using jQuery

我的未来我决定 提交于 2019-12-17 04:39:33
问题 Though both are Webkit based browsers, Safari urlencodes quotation marks in the URL while Chrome does not. Therefore I need to distinguish between these two in JS. jQuery's browser detection docs mark "safari" as deprecated. Is there a better method or do I just stick with the deprecated value for now? 回答1: Using a mix of feature detection and Useragent string: var is_opera = !!window.opera || navigator.userAgent.indexOf(' OPR/') >= 0; var is_Edge = navigator.userAgent.indexOf("Edge") > -1;

Javascript IE detection, why not use simple conditional comments? [duplicate]

限于喜欢 提交于 2019-12-17 03:26:05
问题 This question already has answers here : Check if user is using IE (29 answers) Closed 14 days ago . In order to detect IE most Javascript libaries do all sort of tricks. jQuery seem to add a temporary object into your pages's DOM to detect some features, YUI2 does regex on the user agent in its YAHOO.env.ua = function() (file yahoo.js ) After reading this answer it came in my mind that it's true, in order to detect simply IE in Javascript we could simply add to our pages: <!--[if IE]><script

Javascript IE detection, why not use simple conditional comments? [duplicate]

血红的双手。 提交于 2019-12-17 03:25:08
问题 This question already has answers here : Check if user is using IE (29 answers) Closed 14 days ago . In order to detect IE most Javascript libaries do all sort of tricks. jQuery seem to add a temporary object into your pages's DOM to detect some features, YUI2 does regex on the user agent in its YAHOO.env.ua = function() (file yahoo.js ) After reading this answer it came in my mind that it's true, in order to detect simply IE in Javascript we could simply add to our pages: <!--[if IE]><script

How to detect IE11?

只谈情不闲聊 提交于 2019-12-16 20:02:53
问题 When I want to detect IE I use this code: function getInternetExplorerVersion() { 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 ); } return rv; } function checkVersion() { var msg = "You're not using Internet Explorer."; var ver = getInternetExplorerVersion(); if ( ver > -1 ) { msg = "You are using IE " + ver; } alert( msg ); } But IE11

Deprecated Javascript OS detection techniques

天涯浪子 提交于 2019-12-14 03:55:07
问题 I was wondering why javascript os detection techniques like navigator.userAgent , navigator.appName , navigator.appVersion and navigator.platform are in process of being dropped from web standards. https://developer.mozilla.org/en-US/docs/Web/API/Navigator If you visit every of those navigator props, you can see Deprecated This feature has been removed from the Web standards. Though some browsers may still support it, it is in the process of being dropped. Do not use it in old or new projects

Blocking modern IE?

一个人想着一个人 提交于 2019-12-14 00:43:05
问题 Blocking IE is definitely not best practice, but it's something in my requirements for an existing application. What's the most effective way to do that since conditional comments aren't available in IE 10? For IE 9 and below this will work: <!--[if IE]> <script type="text/javascript"> window.location = "/IEblocked.html"; </script> <![endif]--> Assuming there's a best practice JavaScript solution, what gotchas might I find? I'm wondering if there might be issues around the following: Order of