Several ways to embed SWF files in Web pages

Source: Internet
Author: User

1. The traditional method of Object + embed

Pros: Good browser compatibility is the official method Macromedia has always been
Disadvantages:
A.embed tags are not compliant and cannot be verified. Of course, if you do not care about what norms are not standardized, another matter.
B. Microsoft for various reasons, after SP2 restrictions on the use of IE ActiveX mode, that is, in the page ActiveX has a virtual box, the user needs 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.
C. No flash version detection, if the version of the browser Flash plugin version is not enough, or can not display your SWF file normally, or will pop up an ActiveX confirmation installation box.

<object id= "Forfun" classid= "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width= "300" height= "
codebase= "http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" >
<param name= "movie" value= "/seufld/seufld/flash/focus2.swf" >
<param name= "Quality" value= "High" >
<param name= "bgcolor" value= "#F0F0F0" >
<param name= "Menu" value= "false" >
<param name= "wmode" value= "opaque" ><!--window| opaque| Transparent-->
<param name= "flashvars" value= "" >
<param name= "allowscriptaccess" value= "Samedomain" >
<embed id= "Forfunex" src= "/seufld/seufld/flash/focus2.swf"
Width= "400"
height= "300"
Align= "Middle"
Quality= "High"
Bgcolor= "#f0fff8"
Menu= "false" <!--added, FF only normal--
Play= "true"
Loop= "false"
Flashvars= ""
Allowscriptaccess= "Samedomain"
Type= "Application/x-shockwave-flash"
Pluginspage= "Http://www.adobe.com/go/getflashplayer" >
</embed>
</object>


================ Split Line ================

2. Single 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:

<object type= "Application/x-shockwave-flash" Data= "c.swf?path=movie.swf"
Width= "height=" >
<param name= "movie" value= "c.swf?path=movie.swf"/>
</object>


Pros: This method is not embed, can be verified, browser compatibility is also good
Disadvantages:
A. A holder SWF is required to load your target SWF to ensure the stream capability in IE, which can be cumbersome if you need to pass through flashvars to communicate with the page's JS.
B.activex of the virtual box problem.
C. No version detection.
D. There are still a few user agents (such as some versions of Safari and some screen readers) that do not recognize this way and have bugs.

================ Split Line ================

3. Double Object
<object id= "Exercises" classid= "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width= "214" height= "144" >
<param name= "movie" value= "${contextpath}/flex/photo.swf"/>
<param name= "wmode" value= "window"/>
<param name= "flashvars" value= ""/>
<!--[if! ie]><!-->
<object id= "Exercisesex" type= "Application/x-shockwave-flash"
Data= "${contextpath}/flex/photo.swf" width= "214" height= "144" >
<param name= "flashvars" value= ""/>
<!--<! [endif]-->
<!--[if GTE IE 6]>
<! [endif]-->
<!--[if! ie]><!-->
<!--<! [endif]-->
<a href= "Http://www.adobe.com/go/getflashplayer" >

</a>
<!--[if! ie]><!-->
</object>
<!--<! [endif]-->
</object>


================ Split Line ================

4. Standard methods offered by Flex
<!--BEGIN Browser history Required sections---
<link rel= "stylesheet" type= "Text/css" href= "Http://xuguangzhi2003.blog.163.com/blog/history/history.css"/>
<!--END Browser history Required sections---

<script src= "Http://xuguangzhi2003.blog.163.com/blog/AC_OETags.js" language= "JavaScript" ></script>

<!--BEGIN Browser history Required sections---
<script src= "Http://xuguangzhi2003.blog.163.com/blog/history/history.js" language= "JavaScript" ></script >
<!--END Browser history Required sections---

<style>
body {margin:0px; Overflow:hidden}
</style>
<script language= "JavaScript" type= "Text/javascript" >
<!--
// -----------------------------------------------------------------------------
Globals
Major version of Flash required
var requiredmajorversion = 9;
Minor version of Flash required
var requiredminorversion = 0;
Minor version of Flash required
var requiredrevision = 60;
// -----------------------------------------------------------------------------
-
</script>

<body scroll= "No" >
<script language= "JavaScript" type= "Text/javascript" >
<!--
Version Check for the Flash player of the ability to start Player Product Install (6.0R65)
var hasproductinstall = detectflashver (6, 0, 65);

Version check based upon the values defined in Globals
var hasrequestedversion = Detectflashver (requiredmajorversion, requiredminorversion, requiredrevision);

if (Hasproductinstall &&!hasrequestedversion) {
Don't MODIFY the following four LINES
Location visited after installation are complete if installation is required
var Mmplayertype = (Isie = = True)? "ActiveX": "PlugIn";
var mmredirecturl = window.location;
Document.title = Document.title.slice (0, +) + "-Flash Player Installation";
var mmdoctitle = Document.title;

Ac_fl_runcontent (
"src", "Playerproductinstall",
"Flashvars", "mmredirecturl=" +mmredirecturl+ ' &mmplayertype= ' +mmplayertype+ ' &mmdoctitle= ' +MMdoctitle+ ',
"width", "100%",
"Height", "100%",
"Align", "Middle",
"id", "manageplatform",
"Quality", "High",
"bgcolor", "#869ca7",
"Name", "Manageplatform",
"allowScriptAccess", "Samedomain",
"Type", "Application/x-shockwave-flash",
"Pluginspage", "Http://www.adobe.com/go/getflashplayer"
);
} else if (hasrequestedversion) {
If we ' ve detected an acceptable version
Embed the Flash Content SWF when all tests is passed
Ac_fl_runcontent (
"src", "manageplatform",
"width", "100%",
"Height", "100%",
"Align", "Middle",
"id", "manageplatform",
"Quality", "High",
"bgcolor", "#869ca7",
"Name", "Manageplatform",
"allowScriptAccess", "Samedomain",
"Type", "Application/x-shockwave-flash",
"Pluginspage", "Http://www.adobe.com/go/getflashplayer"
);
} else {//Flash is too old or we can ' t detect the Plugin
var alternatecontent = ' Alternate HTML content should is placed here. ‘
+ ' This content requires the Adobe Flash Player. ‘
+ ' <a href=http://www.adobe.com/go/getflash/>get flash</a> ';
document.write (AlternateContent); Insert Non-flash Content
}
-
</script>
<noscript>
<object classid= "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
Id= "Manageplatform" width= "100%" height= "100%"
codebase= "Http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab" >
<param name= "movie" value= "manageplatform.swf"/>
<param name= "Quality" value= "High"/>
<param name= "bgcolor" value= "#869ca7"/>
<param name= "allowscriptaccess" value= "Samedomain"/>
<embed src= "http://xuguangzhi2003.blog.163.com/blog/ManagePlatform.swf" quality= "High" bgcolor= "#869ca7"
Width= "100%" height= "100%" name= "Manageplatform" align= "Middle"
Play= "true"
Loop= "false"
Quality= "High"
Allowscriptaccess= "Samedomain"
Type= "Application/x-shockwave-flash"
Pluginspage= "Http://www.adobe.com/go/getflashplayer" >
</embed>
</object>
</noscript>


================ Split Line ================

5. SWFObject

http://code.google.com/p/swfobject/

   <title> ; SWFObject 2 Dynamic Publishing Example Page</title> 
<meta http-equiv= "Content-type" content= "text/html ; Charset=iso-8859-1 "/>
<script type=" Text/javascript "src=" Swfobject.js "></SCRIPT>
&L T;script type= "Text/javascript",
swfobject.embedswf ("test.swf", "mycontent", "+", "+", "9.0.0", "express Install.swf ");
</script>
<body>
<div id= "mycontent";
<p><a href= "Http://www.adobe.com/go/getflashplayer" >&L T;img src= "http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif"
alt= "get Adobe Flash Player "/></A></P>
</div>
</body>


================ Split Line ================

6. Single embed display IE7 and FF3 can be displayed normally


height= "align=" "Middle" >

Several ways to embed SWF files in Web pages

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.