browser-detection

Detect iPad users using jQuery?

巧了我就是萌 提交于 2019-11-26 02:40:27
问题 Is there a way to detect if the current user is using an iPad using jQuery/JavaScript? 回答1: iPad Detection You should be able to detect an iPad user by taking a look at the userAgent property: var is_iPad = navigator.userAgent.match(/iPad/i) != null; iPhone/iPod Detection Similarly, the platform property to check for devices like iPhones or iPods: function is_iPhone_or_iPod(){ return navigator.platform.match(/i(Phone|Pod))/i) } Notes While it works, you should generally avoid performing

Detecting iOS / Android Operating system

旧巷老猫 提交于 2019-11-26 01:56:07
问题 I\'ve done some research, and this question has come up, but not in the way I intend. I\'m building a page for a client that is a QR code landing, which is a place to download an application. So he doesn\'t have to print out 2 QR codes on a page, I\'d like to detect the current operating system (Apple/Android/Other[not supported]) and modify my elements based on that value. I\'ve looked at the script \"detectmobilebrowsers\" and that is just aimed at telling whether or not the user is mobile

JavaScript: How to find out if the user browser is Chrome?

旧街凉风 提交于 2019-11-26 00:21:59
问题 I need some function returning a boolean value to check if the browser is Chrome. How do I create such functionality? 回答1: Update: Please see Jonathan's answer for an updated way to handle this. The answer below may still work, but it could likely trigger some false positives in other browsers. var isChrome = /Chrome/.test(navigator.userAgent) && /Google Inc/.test(navigator.vendor); However, as mentioned User Agents can be spoofed so it is always best to use feature-detection (e.g. Modernizer

Detect Browser Language in PHP

瘦欲@ 提交于 2019-11-25 23:21:02
问题 I use the following PHP script as index for my website. This script should include a specific page depending on the browser\'s language (automatically detected). This script does not work well with all browsers, so it always includes index_en.php for any detected language (the cause of the problem is most probably an issue with some Accept-Language header not being considered). Could you please suggest me a more robust solution? <?php // Open session var session_start(); // views: 1 = first

Detecting a mobile browser

我只是一个虾纸丫 提交于 2019-11-25 22:52:53
问题 I\'m looking for a function which return boolean value if user has mobile browser or not. I know that I can use navigator.userAgent and write that function by using regex, but user-agents are too various for different platforms. I doubt that match all possible devices would be easy, and I think this problem has been solved before many times so there should be some kind of complete solution for such task. I was looking at this site, but sadly the script is so cryptic that I have no idea how to

Detect IE version (prior to v9) in JavaScript

╄→гoц情女王★ 提交于 2019-11-25 22:48:01
问题 I want to bounce users of our web site to an error page if they\'re using a version of Internet Explorer prior to v9. It\'s just not worth our time and money to support IE pre-v9 . Users of all other non-IE browsers are fine and shouldn\'t be bounced. Here\'s the proposed code: if(navigator.appName.indexOf(\"Internet Explorer\")!=-1){ //yeah, he\'s using IE var badBrowser=( navigator.appVersion.indexOf(\"MSIE 9\")==-1 && //v9 is ok navigator.appVersion.indexOf(\"MSIE 1\")==-1 //v10, 11, 12,

Check if user is using IE

纵饮孤独 提交于 2019-11-25 22:46:49
问题 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 Explorer and abort / cancel it if they are using other browsers so that it only runs for IE users ? The users here would all be on IE8 or higher versions so I would not need to cover IE7 and lower versions. If I could tell which browser they are using that would be great but is not required. Example function: $(\'.myClass\').on(\

How can you detect the version of a browser?

时光毁灭记忆、已成空白 提交于 2019-11-25 22:25:07
问题 I\'ve been searching around for code that would let me detect if the user visiting the website has Firefox 3 or 4. All I have found is code to detect the type of browser but not the version. How can I detect the version of a browser like this? 回答1: You can see what the browser says , and use that information for logging or testing multiple browsers. navigator.sayswho= (function(){ var ua= navigator.userAgent, tem, M= ua.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) ||

Browser detection in JavaScript? [duplicate]

别来无恙 提交于 2019-11-25 22:23:49
问题 This question already has answers here : How can you detect the version of a browser? (25 answers) Closed last year . How do I determine the exact browser and version using JavaScript? 回答1: navigator.sayswho= (function(){ var ua= navigator.userAgent, tem, M= ua.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) || []; if(/trident/i.test(M[1])){ tem= /\brv[ :]+(\d+)/g.exec(ua) || []; return 'IE '+(tem[1] || ''); } if(M[1]=== 'Chrome'){ tem= ua.match(/\b(OPR|Edge?)\/(\d+)/);

How to detect Safari, Chrome, IE, Firefox and Opera browser?

前提是你 提交于 2019-11-25 22:14:12
问题 I have 5 addons/extensions for FF, Chrome, IE, Opera, and Safari. How can I recognize the user browser and redirect (once an install button has been clicked) to download the corresponding addon? 回答1: Googling for browser reliable detection often results in checking the User agent string. This method is not reliable, because it's trivial to spoof this value. I've written a method to detect browsers by duck-typing. Only use the browser detection method if it's truly necessary, such as showing