Browserdetection
One of the biggest disadvantages of Flash is that
the user needs to install a plugin to be able to see it. This section show you a way to
make the installation of the plugin as smooth as possible.
Fortunately both MSIE 4 and Netscape 4 can install the plugin automatic. On older browsers
installing the plug-in requires a few steps for the user to follow.
SHORT DESCRIPTION OF THE TECHNIQUE:
The script shown below requires three web-pages to
be present at your site.
1) The webpage witht he flash-movie.
2) The webpage users are taken to before automatic download of plugin if needed.
3) The webpage users are taken to before manual download of the plugin if needed.
In the figure below you will see how the script works:
Check: Does user have plug-in? |
|
Yes |
|
Send user to flashpage |
|
|
|
|
|
|
NO |
|
|
|
|
|
THEN |
|
|
|
|
|
|
Check: Is it a version 4 browser |
|
Yes |
|
Auto-installpage |
|
|
|
|
|
|
NO |
|
|
|
|
|
|
|
|
|
|
Check: Update browser now? |
|
Yes |
|
Browser download-page |
|
|
|
|
|
|
NO |
|
|
|
|
|
|
|
|
|
|
Macromedias Plugin-page |
|
|
|
Reload this page |
As you can see the script will first
detect if the visitor allready has the plug-in. If this is the case the visitor is sent to
the flash-page.
Note the script does not only check if there is a flash-plugin installed. It also checkes
if the version is the one required to visit the flash-movie correctly.
If the visitor does not have the plugin, the script
will check which browser is used.
If it is a version-4 browser, the user will be sent to a page, describing that the plugin
will be installed automatic. After clicking OK the plugin will then be installed.
When the plugin is installed the user is automatic taken to the flash-page.
If it is an older version the user will be sent to a page, that offers the user to either
update the browser or jump to the plug-in-download-page at macromedias site.
Whether the visitor chooses the one or the other the detection-page needs to be reloaded
after installing the plugin or the updated browser.
THE FLASH-DETECTION-SCRIPT:
Below you see the code for the page that detects if the plugin is present or not.
NOTE: You need to enter these three URL's:
1) The URL of the actual flashpage.
In the script this page is referred to as flashpage.
2) The URL of the page to jump to when using version 4 browser and plugin is not
installed.
In the script this page is referred to as autodetectpage.
3) The URL of the page to jump to when using older browser and the plugin is not
installed.
In the script this page is referred to as manualdetectpage.
In the script shown below the lines where you should enter these URL's are highlighted.
<html>
<head>
<title>Shockwave Flash Detection</title>
<SCRIPT LANGUAGE="JavaScript">
<!-- hide code
// define pages
flashpage="flashpage.htm";
autodetectpage="autodetect.htm";
manualdetectpage="manualdetect.htm";
// detect browser
bName = navigator.appName;
bVer = parseInt(navigator.appVersion);
// assign base variables
flash = "no"
flashver = "1.0"
action = "ns_exec"
// detect plugin for NS flash 3 version
if (bName=="Netscape") {
if (navigator.plugins["Shockwave Flash 2.0"]) {flashver = "2.0"}
else if(navigator.plugins["Shockwave Flash"]) {flashver = "3.0"}
if (flashver == "3.0") {flash = "yes";}
// activate if other release comes out
// flashver = navigator.plugins["Shockwave Flash"].description.substring(16,19);
} else if (bName =="Microsoft Internet Explorer") { action = "ie_exec"
}
//-->
</SCRIPT>
</head>
<body bgcolor="White" text="Black">
<center>
<SCRIPT LANGUAGE="VBScript">
<!--
on error resume next
If action = "ie_exec" then
FlashInstalled =(IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.3")))
End If
If FlashInstalled = "True" then
flash = "yes"
End If
//-->
</SCRIPT>
<SCRIPT LANGUAGE="JavaScript">
<!-- Actions
if (flash == "yes") {window.location=flashpage}
else if (flash == "no")
{
if (navigator.appVersion.indexOf("4.0")!=-1) {window.location=autodetectpage}
// Flash can be installed automatic
else {window.location=manualdetectpage}
// Flash needs manual installation
}
//-->
</SCRIPT>
<NOSCRIPT>Whatever</NOSCRIPT>
</center>
</body>
</html> |
THE AUTODETECTION-PAGE:
Click here to see an example of a page the
visitor should be sent to before automatic installing the plugin.
This is the page visitors using version 4 browsers would be sent to.
Note: After confirming installation of the plugin, the user is simply taken to the
flashpage itself.
The autodetection-page is simply a normal HTML-document informing the visitor that the
plugin will be installed.
When you embed flashmovies in your HTML-documents you specify the URL of the pluginspage.
This information is what the browser uses to automatic install the plugin on version 4
browsers. Therefore you do not need to have a specific page dedicated to automatic
installation of the plugin. Read more details about this in the Embed
in HTML-section.
You might choose to simply skip this informative page.
Since the plugin is actually installed automatic the user does not HAVE to be informed
about it. However two obvious reasons would advice that you did not skip this page:
1) The user will be prompted by the browser before the plugin is installed. If the user
was not informed in advance about the installation he might be insecure of what is going
on, and thus choose not to confirm the plugin-installation.
2) It is common netiquette to inform the visitor to your page before installing plugins.
THE MANUALDETECTION-PAGE:
Click here to see an example of a
page the visitor should be sent to before automatic installing the plugin. This is the
page visitors using browsers older than version 4 would be sent to.
The page advices the user to get an update of the browser. If the user does not want to
update the browser, the page offers to manually install the plugin, by following the link
to Macromedias manual-plugin-installation-page.
SAMPLE-PAGE:
Click here to see a page that uses
the entire script and informative pages described above.
|