The main one is the following: w3school JS .
The code:
<script> txt = "<p>Browser CodeName: " + navigator.appCodeName + "</p>"; txt+= "<p>Browser Name: " + navigator.appName + "</p>"; txt+= "<p>Browser Version: " + navigator.appVersion + "</p>"; txt+= "<p>Cookies Enabled: " + navigator.cookieEnabled + "</p>"; txt+= "<p>Platform: " + navigator.platform + "</p>"; txt+= "<p>User-agent header: " + navigator.userAgent + "</p>"; txt+= "<p>User-agent language: " + navigator.systemLanguage + "</p>"; document.getElementById("example").innerHTML=txt; </script>
But this is not sure about -webkit-.
Here is the fiddle for this, I mean the fiddle for warning -webkit-browser! (Only for Chrome, only for Safari, Opera 15+ is not yet supported!) Jsfiddle.
Here is the jQuery code for this! try the following:
$(document).ready(function(){ $.browser.chrome = /chrome/.test(navigator.userAgent.toLowerCase()); if($.browser.chrome){ $.browser.safari = false; } if($.browser.safari){ } });
This will display a popup as soon as the windows load!
The best and easiest and most understandable solution would be the following:
$.browser.chrome = $.browser.webkit && !!window.chrome; $.browser.safari = $.browser.webkit && !window.chrome; if ($.browser.chrome) alert("You are using Chrome!"); if ($.browser.safari) alert("You are using Safari!");
These were the basics I found on some sites:
- w3schools.com
- /qaru.site / ... (I used this site to search for scripts.
Afzaal Ahmad Zeeshan Sep 04 '13 at 23:37 2013-09-04 23:37
source share