| The javascript browser snifer makes an extensive use of regular expressions and the search() and match() functions.
By this function, you can know following information: [1] browser type [2] browser version [3] os type [4] os version [5] flash installation information
Actually this script is effective when making web log.
The following is the example of Javascript based Browser Sniffing.
<script type="text/javascript" src="js/brwsniff.js"></script>
<script type="text/javascript"> var br=new Array(4); var os=new Array(2); var flash=new Array(2); br=getBrowser(); os=getOS(); flash=hasFlashPlugin(); document.write("Browser identifier: "+br[0]+"<br />"); document.write("Browser version: "+br[1]+"<br />"); document.write("Browser major version: "+getMajorVersion(br[1])+"<br />"); document.write("Browser minor version: "+getMinorVersion(br[1])+"<br />"); document.write("Browser engine: "+br[2]+"<br />"); document.write("Browser engine version: "+br[3]+"<br />"); document.write("Full user agent string: "+getFullUAString()+"<br />"); document.write("Operating system identifier: "+os[0]+"<br />"); document.write("Operating system version: "+os[1]+"<br />"); document.write("Is Flash installed? " + (flash[0]==2 ? "Yes" : (flash[0] == 1 ? "No" : "unknown")) + "<br />"); document.write("Flash version: "+flash[1]+"<br />"); </script>
You can download the latest full script and demo at http://jsbrwsniff.sourceforge.net/
1385212200.zip |