Flash Player detection
Substituting an image for a Flash Player movie on the fly
The following code will work on all browsers that understand either JavaScript or ActiveX. If the browser supports the MIME Type application/futuresplash, the script writes out an EMBED tag; otherwise, it writes an IMG tag. The OBJECT tag is invoked on any browser that supports ActiveX, regardless of which tag the JavaScript writes. The lines starting with "//" are comments, as are the lines enclosed in " " The browser ignores the former as "not part of the JavaScript to be executed," and the latter as "not part of the HTML to be displayed."
CODEBASE="http://active.macromedia.com/flash/cabs/swflash.cab#version=3,0,0,11"
WIDTH="220" HEIGHT="110" NAME="sw" ID="sw">
Make sure there are no line breaks in your EMBED or IMG tags, or the script will fail. If you'd like to use line breaks, put each line in a separate document.write() . Notice that the entire EMBED and IMG strings are enclosed in single quotes; this allows for double quotes to be inside the strings without breaking them. If you want to put an apostrophe in your string (as in ALT="Your browser doesn't support Flash Player" ), you'll need to escape it with a backslash so that it doesn't close the string prematurely ( ALT="Your browser doesn\'t support Flash Player" ).
The following code will work on all browsers that understand either JavaScript or ActiveX. If the browser supports the MIME Type application/futuresplash, the script writes out an EMBED tag; otherwise, it writes an IMG tag. The OBJECT tag is invoked on any browser that supports ActiveX, regardless of which tag the JavaScript writes. The lines starting with "//" are comments, as are the lines enclosed in " " The browser ignores the former as "not part of the JavaScript to be executed," and the latter as "not part of the HTML to be displayed."
CODEBASE="http://active.macromedia.com/flash/cabs/swflash.cab#version=3,0,0,11"
WIDTH="220" HEIGHT="110" NAME="sw" ID="sw">
Make sure there are no line breaks in your EMBED or IMG tags, or the script will fail. If you'd like to use line breaks, put each line in a separate document.write() . Notice that the entire EMBED and IMG strings are enclosed in single quotes; this allows for double quotes to be inside the strings without breaking them. If you want to put an apostrophe in your string (as in ALT="Your browser doesn't support Flash Player" ), you'll need to escape it with a backslash so that it doesn't close the string prematurely ( ALT="Your browser doesn\'t support Flash Player" ).
Nhận xét
Đăng nhận xét