Javascript checks whether the browser supports the flash implementation code. javascriptflash

Source: Internet
Author: User

Javascript checks whether the browser supports the flash implementation code. javascriptflash

Javascript checks whether the browser supports flash. The output result is as follows:

<Script> function flashChecker () {var hasFlash = 0; // whether flash var flash version = 0 is installed; // if (document. all) {var swf = new ActiveXObject ('shockwaveflash. shockwaveFlash '); if (swf) {hasFlash = 1; VSwf = swf. getVariable ("$ version"); flashVersion = parseInt (VSwf. split ("") [1]. split (",") [0]) ;}} else {if (navigator. plugins & navigator. plugins. length> 0) {var swf = navigator. plugins ["Shockwave Flash"]; if (swf) {hasFlash = 1; var words = swf. description. split (""); for (var I = 0; I <words. length; ++ I) {if (isNaN (parseInt (words [I]) continue; flashVersion = parseInt (words [I]) ;}}} return {f: hasFlash, v: flashVersion };}var fls = flashChecker (); var s = ""; if (fls. f) document. write ("you have installed flash. The current flash version is:" + fls. v + ". x "); else document. write ("You have not installed flash"); </script>

JS method for determining whether the browser supports flash

?????? The following code checks whether the browser supports flash.
<SCRIPT type = text/javascript <! --
Var I _flash;
Var v_flash;
// Netscape
If (navigator. plugins ){
For (var I = 0; I <navigator. plugins. length; I ++ ){
If (navigator. plugins [I]. name. toLowerCase (). indexOf (\ "shockwave flash \") = 0 ){
I _flash = true;
V_flash = navigator. plugins [I]. description. substring (navigator. plugins [I]. description. toLowerCase (). lastIndexOf (\ "flash \") + 6, navigator. plugins [I]. description. length);} // -- </SCRIPT
<SCRIPT type = text/script <! -- // IE
On error resume next
Set f = CreateObject (\ "ShockwaveFlash. ShockwaveFlash \")
If IsObject (f) then
I _flash = true
V_flash = hex (f. FlashVersion () end if
// -- </SCRIPT
<SCRIPT type = text/javascript <! --
If (I _flash ){
Document. writeln (\ "you have installed the Flash plugin \")
If (v_flash ){
Document. writeln (\ "-version \" + v_flash);} else {
Document. writeln (\ "You have not installed the Flash plug-in \")

Javascript checks whether flash is installed and its version

Generally, when we use Flash on a webpage, we do not consider which version of Macromedia Flash Player is used by users. In fact, although more than 90% of users have installed Flash Player Plug-ins, not all plug-ins installed are relatively new versions of Flash 5 or 6. When you use some unique features of the new Flash version, users who only have installed the Flash Player of the old compatible version may not be able to watch the content you have made. At the same time, for users who do not use IE browsers, their browsers may not support plug-ins to automatically prompt for installation, which is even worse. For developers, the availability of their products should not be dependent on the user's high IQ at any time. If you expect users to discover and solve these player compatibility and download and Installation Problems by reading your help page, your product will not be left behind by users. To enable normal playback of your Flash files on each user's browser, We must accurately know whether the user has installed the Flash Player Plug-in and the version number of the plug-in. Navigator. mimeTypes ["application/x-shockwave-flash"]. enabledPlugin: 0; if (plugin) {var words = navigator. plugins ["Shockwave Flash"]. description. split (""); for (var I = 0; I <words. length; ++ I) {if (isNaN (parseInt (words [I]) continue; var MM_PluginVersion = words [I];} var MM_FlashCanPlay = MM_PluginVersion >=mm_contentversion ;} else if (navigator. userAgent & navigator. userAgent. indexOf ("MSIE")> = 0 & (navigator. appVersion. indexOf ("Win ")! =-1) {// FS hide this from IE4.5 Mac by splitting the tag document. write ('<SCR' + 'ipt LANGUAGE = VBScript \> \ n'); document. write ('on error resume next \ n'); document. write ('Mm _ FlashCanPlay = (IsObject (CreateObject ("ShockwaveFlash. shockwaveFlash. "& MM_contentVersion) \ n'); document. write ('</SCR' + 'ipt \> \ n');} if (MM_FlashCanPlay) {alert ("Flash Detection OK. U can play. ");} else {alert (" Flash Detection Failed. need Download ...... remaining full text>

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.