How to Check for IE7 With JavaScript
JavaScript has several interactive features, one of which is browser detection. Many different browsers are available to users today, such as Internet Explorer, Firefox, Chrome and Safari. JavaScript is one method that lets you pinpoint which browser is being used and display content specific to that browser. While processing that data within JavaScript is harder, simply detecting a version of Internet Explorer is a straightforward task.
Instructions
-
-
1
Type "<script type="text/javascript">" to begin a section of JavaScript on your Web page.
-
2
Type the following on the next line:
document.write("Browser Name: " + navigator.appName);
That will write the name of the browser on the Web page as text.
-
-
3
Type this on the next line:
document.write("Browser Version: " + navigator.appVersion);
That will write the version of Internet Explorer being used. The number after the letters "MSIE" is the most updated version.
-
4
Type on the next line "</script>" to end your JavaScript segment.
-
1
Tips & Warnings
While checking for a browser version can be simple, programming your website to act differently for each version requires further research.
References
- Photo Credit Email Concept image by wayne ruston from Fotolia.com