- < SCRIPT LANGUAGE="JavaScript">
- <!--
- var SWF = New ActiveXObject (' Shockwaveflash.shockwaveflash ');
- (SWF)? Document.writeln (' You have installed the plugin '): Document.writeln (' You do not install plugins ');
- // -- >
- </ 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 = " the" HEIGHT="A" 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 ways to detect plugin, because you can't solve the problem with just one method, so there are so many ways
First, the built-in detection
nn and Mac on IE cannot use the following detection, only win on IE can
1, that is, the need to install
In IE tools-internet option-advanced-view inside the on-demand option if it comes into effect, flash Player ActiveX control will be downloaded from MS's website when required by the browser
If not effective, you do not install plugin and directly into the Web page, you will see a cracked box like the small icon, click can also take you to install
2, HTML inside the object tag inside the ClassID and CODEBASE attributes
ClassID is the identity of ActiveX control, such as Flash Player:
clsid:d27cdb6e-ae6d-11cf-96b8-444553540000
CodeBase is the address of the download plugin, such as FLASH4 (if the browser checks that the number behind version is lower than you already have, 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 in flash, public or DW.
When the browser executes these tags, it will be tested.
Second, the use of script to detect
This approach is designed to get rid of the limitations of the previous approach, such as the "Check Plug-in" behavior in DW.
This approach is not available on some machines that cannot execute script, such as the previous version of IE4.5 on Mac, ie above WIN31.
There are also some users who are shutting down the scrpit execution.
Third, the use of flash to detect
If the user does not even carry out the scrpit, it can only use this trick. This is also the method of mm own use.
Do a test of HTML, put a SWF inside, there is only one sentence Geturl ("Your real page")
At the same time in the HTML <HEAD> inside put <meta http-equiv= "Refresh" content= "10; Url= "No Flash page Installed" >
If the SWF doesn't take you to the real page within 10 seconds, the instrumented HTML will take you to a page that's not installed.
Four, the last way, let the user choose
This is also the most common, many sites do a portal page, the following has installed plugin small icon
- <!--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 for
- End If
- Next
- Flashmode = (mm_flashcontrolversion >= 5)
- If Flashmode = True Then
- document.write "HTML with Flash"
- Else
- document.write "No flash HTML"
- End If
- </ SCRIPT >
- < 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.len Gth; ++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< /c17>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 (' No flash HTML '); }