Thursday 15 September 2011

Cross-Browse Dynamic HTML Checking for Browser


The document.layers object is specific to Netscape 4.0, while the document.all object is specific to IE 4.0. So by checking if the object exists we can create the boolean variables ns4 (for Netscape 4.0) and ie4 (for Internet Explorer 4.0) and assign them true or false depending on which browser is being used. Now whenever you need to check which browser someone is using you just have to use if (ns4) or if (ie4):
ns4 = (document.layers)? true:false
ie4 = (document.all)? true:false

No comments:

Post a Comment

Please Give Your Valuable Comments on this Topic

Archives