Embed compatibility issues with HTML

Source: Internet
Author: User

First of all, IE only support the resolution of object, Firefox, Google, Safari only support the parsing of embed.

1, the traditional method

<ObjectClassID= "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"codebase= "http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0"width= "550"Height= "The "ID= "Untitled-1"Align= "Center">    <paramname= "allowScriptAccess"value= "Samedomain" />    <paramname= "movie"value= "mymovie.swf" />    <paramname= "Quality"value= "High" />    <paramname= "bgcolor"value= "#ffffff" />    <Embedsrc= "mymovie.swf"Quality= "High"bgcolor= "#ffffff"width= "550"Height= "The "name= "Mymovie"Align= "Center"allowscriptaccess= "Samedomain"type= "Application/x-shockwave-flash"pluginspage= "Http://www.macromedia.com/go/getflashplayer" /></Object>

This method is embedded using the object and embed tags, and careful to find that many of the parameters of object and embed many of the properties are duplicated, why do you do this? For browser compatibility, some browsers support object, some support embed, which is why to change the parameters of Flash two places to change the reason. This method is Macromedia has been the official method, the maximum guarantee the function of Flash, no compatibility issues.

But it's not that good anymore: it can't be verified, because the embed tags embedded for compatibility are not compliant. Of course, if you do not care about what norms are not standardized, another matter.
Microsoft for various reasons, after SP2 restrictions on the use of IE ActiveX mode, that is, in the page ActiveX has a virtual box, users need to click once to normal interaction. Flash is embedded as an ActiveX in the Web page, so it will also be implicated, only by JS embedded Flash to solve this problem.
No flash version detection, if the version browser Flash plugin version is not enough, or can not display your SWF file normally, or will pop up an ActiveX confirmation installation box-this box for many users is very scary.

2, only use the method of object

The name of this method is called Flash Satay, which was first published in 2002 by Drew McLellan on a List Apart, and later after several improvements:

<Objecttype= "Application/x-shockwave-flash data="C.swf?path=movie.swf "width= "The "Height= "+">     <paramname= "movie"value= "c.swf?path=movie.swf" />     <imgsrc= "Noflash.gif"width= "$"Height= "+"alt="" /> </Object> 

This method is not embed, can be verified, is the standard method of embedding Flash, browser compatibility is also good, looks almost perfect, but there is a problem: need a holder SWF to load your target SWF to ensure that the stream in IE, if you need to pass F Lashvars to pass the argument, or with the page JS interaction, will be very troublesome. With the 2nd above, the virtual box problem of ActiveX. Go ahead. There is no version detection or a few user agents (such as some versions of Safari and some screen readers) do not recognize this way, there are bugs.

3, using JS embedding method

With JS embedding is each have each embedding method, there is good inlay is not well embedded. Someone with Document.Write Direct write, this way to tell the truth is not good, feel hack ingredient more, a bit to verify and verify the meaning, and did not reflect what JS advantage. I think a good JS embedded script, in order to ensure that the function of Flash, JS should have the advantage of version detection, to be able to solve the accessibility problem (that is, users can not browse the Flash content or to disable JS when the problem should be how to deal with), to be easy to re-use.

I know the more common JS embedding method has the following:

SWFObject

Ufo-unobtrusive Flash Objects

Macomedia (It's adobe now.) ) Provide the script [here] and [here].

SWFObject use more, just pick it to say some of the advantages of this method:

There is no annoying virtual box problem in IE. Provides a complete version of the detection function, if the version is not enough to show other things, than slices or text. Easy to use, just load a. js file in the header of the page, and then HTML to write a container, put ordinary text or pictures (for the display when Flash is not displayed), and finally replace the content of this element with a script flash.

Can be verified-this isn't the point, of course, it's just a passing effect.

4, Summary: Using JS embedded Flash is the most perfect method

Although this is a compromise because of the browser's various problems. But it is in the premise of ensuring that the Flash function is also using JS to provide additional benefits, and then someone has written a very perfect embedded script can be used in the context of underground (recommended SWFObject), we have no reason to use it? SWFObject that Web page is in English,

Here's a simple usage tutorial: Download its. js file, here: Http://blog.deconcept.com/swfobject/swfobject1-4.zip (if the link fails, the version may be updated, Please use the address given above to go to the homepage to download the latest version)

Embed this script file in your HTML page header

Write a container for Flash in your HTML, such as <div>, and give an id like flashcontent. Then put your replacement content in it.

<div id= "Flashcontent" > here to replace content to display when Flash cannot be displayed. </div>

Replace the content with a script:

<Scripttype= "Text/javascript">   var So= NewSWFObject ("movie.swf", "Mymovie", " $", " -", "7", "#336699");//parameter meaning: address, Flash ID (not container ID), width, height, version requirement, background color//This is the most basic, if you want to advanced settings, you have to carefully turn over the instructions. So.write ("flashcontent");</Script>

The script can be written in HTML or in an external. js file.

Embed compatibility issues with HTML

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.