< Script Language = " Javascript " >
<! --
VaR SWF = New Activexobject ('shockwaveflash. shockwaveflash ');
(SWF) ? Document. writeln ('you have installed the plug‑in '): Document. writeln ('you have not installed plug‑in ');
// -->
</ Script >
Dynamic loading.
<Object classid = "CLSID: D27CDB6E-AE6D-11cf-96B8-444553540000" id = "mflash"
Codebase = "http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"
Width = "120" Height = "60" id = "468x60" align = "" viewastext>
<Param name = Quality value = high>
</Object>
<Input type = button onclick = "addflash ()" value = "add">
<Input type = button onclick = "mflash. Stop ()" value = "stop">
<Input type = button onclick = "mflash. Play ()" value = "play">
<SCRIPT>
Function addflash (){
Mflash. Movie = "http://expert.csdn.net/images/ad/WIBU.swf ";
Mflash. Play ();
}
</SCRIPT>
There are many methods for detecting plugin, because this problem cannot be solved by using only one method, so there are so many methods.
I. built-in Detection
Nn and IE on Mac cannot use the following detection, only ie on win can
1. Installation on demand
If the on-demand Installation option in IE tool-Internet option-advanced-browser takes effect, the browser will download the Flash Player ActiveX control from the website of Ms.
If the plug-in does not take effect, you can directly access the webpage without installing plug-in, and you will see a small icon like a split square. Click it to install it.
2. The classid and codebase attributes in the object tag in HTML
Classid is the identifier of ActiveX control, for example, Flash Player:
CLSID: D27CDB6E-AE6D-11cf-96B8-444553540000
Codebase is the address for downloading the plug-in, for example, flash4 (if the number behind the version is lower than your existing version, it will not be installed ):
Http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=4,0,2,0
These HTML tags are automatically added when you insert them to the public or dw file in flash.
The Browser executes these labels to detect them.
2. Use scripts to detect
This method is used to get rid of the limitations of the previous method. For example, the behavior named "Check plug-in" in DW
This method is still unavailable on some machines that cannot execute scripts, such as IE on ie4.5 or earlier versions on Mac and IE on win31.
Some users disable scrpit execution.
3. Use flash for Detection
If you do not even execute scrpit, you can only use this method. This is also the method used by mm itself.
Make a moderation HTML with a SWF in it, containing only one geturl ("your real page ")
At the same time in the HTML If SWF does not take you to the real page within 10 seconds, the detected HTML will take you to the page not installed.
4. The last method allows users to choose
This is also the most common. Many websites have an entry page. Below is a small icon for installing plugin.
<! -- Start VBScript plugin Detection -->
< Script Language = VBScript >
Private I, X, mm_flashcontrolversion
On Error resume next
X = Null
Mm_flashcontrolversion = 0
VaR Flashmode
Flashmode = False
For I = 5 To 1 Step - 1
Set x = Createobject ( " Shockwaveflash. shockwaveflash. " & I)
Mm_flashcontrolinstalled = Isobject (X)
If mm_flashcontrolinstalled then
Mm_flashcontrolversion = CSTR (I)
Exit
End if
Next
Flashmode = (Mm_flashcontrolversion > = 5 )
If flashmode = True then
Document. Write " HTML with Flash "
Else
Document. Write " HTML without flash "
End if
</ Script > <! -- End VBScript plugin Detection -->
< Script Type = " Text/JavaScript " Language = " Javascript " >
<! -- Start JS Detection
Flashmode = 0 ;
If (Navigator. plugins && Navigator. plugins. Length > 0 )
{
If (Navigator. plugins [ " Shockwave Flash " ])
{
VaR Plugin_version = 0 ;
VaR Words = Navigator. plugins [ " Shockwave Flash " ]. Description. Split ( " " );
For ( VaR I = 0 ; I < Words. length; ++ I)
{
If(Isnan (parseint (words [I])
Continue;
Plugin_version=Words [I];
}
If (Plugin_version > = 5 )
{
VaR Plugin = Navigator. plugins [ " Shockwave Flash " ];
VaR Numtypes = Plugin. length;
For (J = 0 ; J < Numtypes; j ++ )
{
Mimetype = Plugin [J];
If (Mimetype)
{
If (Mimetype. enabledplugin && (Mimetype. suffixes. indexof ( " SWF " ) ! = - 1 ))
Flashmode = 1 ;
// Mac wierdness
If (Navigator. mimetypes [ " Application/X-Shockwave-flash " ] = Null )
Flashmode = 0 ;
}
}
}
}
}
If (Flashmode = 1 )
{
Document. Write ('html with Flash ');}
Else {
Document. Write ('html without flash ');}
// End JS detection -->
Http://bbs.blueidea.com/viewthread.php? Tid = 234550 & page