Resources | JavaScript | Detect Plug-Ins

Detect Plug-Ins:


The most recent versions of Internet Explorer and Netscape come with Shockwave's Flash built into their browsers. However, older versions (as well as other types of browsers) require the user to download Flash before the browser can display Flash animations.

If you are adding features to your website that require a certain type of plug-in, it is always good practice to check to see if a browser has that specific plug-in installed. The following code will show you how to check for Flash on Netscape and Internet Explorer. The code can quickly be altered, both to check for different types of plug-ins and also for use with different types of browsers.

First, check which browser is being used (to simplify things, we're assuming that the browser is going to be either Netscape or IE -- to be complete, you should change this code to take into consideration other browsers such as Opera):


The following function is to check for the plug-in for IE browsers -- in this case we will redirect the user to another page if they don't have Flash:



The following function is to check for the plug-in for Netscape browsers -- like the above example, we will send the user to a different page if they do not have Flash installed:


Finally, at some point in your page (before you begin writing out the HTML content) you want to call the "scriptName" function -- the following code is just one way to do it (one other option would be to take the previous code out of the "functions," and just have the browser read it in-line):


Remember, if you're going to use a Response.Redirect to change the page location, you need to set the Response.Buffer = true and call the Response.Redirect before *any* HTML is sent over to the user.

Related Links: Detect Browser Type | Detect Resolution


Want to discuss this article, or other development issues? Visit our message boards!

Or contact us directly with a comment or question on this article: click here !
armbrustconsulting.com