How to Check for IE7 With JavaScript

How to Check for IE7 With JavaScript thumbnail
JavaScript can detect browser versions and present different HTML accordingly.

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.

Things You'll Need

  • HTML compiler
Show More

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.

Tips & Warnings

  • While checking for a browser version can be simple, programming your website to act differently for each version requires further research.

Related Searches:

References

  • Photo Credit Email Concept image by wayne ruston from Fotolia.com

Comments

You May Also Like

Related Ads

Featured