简体   繁体   中英

Embed Flash (SWF) without JavaScript

How can I embed a Flash SWF file into an HTML page without using JavaScript libraries ?

The Flash movie is an advertisement which will run on sites that don't have any JavaScript libraries available (like SWFObject). My only capability is to render a piece of HTML using document.write . I do not wish to add any external script tags (or write them for that matter).

The browser requirements are basically "all browsers":

  • IE6+
  • FF2+
  • Chrome, Safari (WebKit)
  • Recent version of Opera (not 100% required)

I do not care about validation. The only goal is to make it work reliably.

use <object> <object/> & The OBJECT tag is used by Internet Explorer on Windows, EMBED is used by Netscape Navigator (Macintosh and Windows) and Internet Explorer (Macintosh) tag like this:

<object type="application/x-shockwave-flash" data="myclip.swf"> 
    <param name="movie" value="myclip.swf" />
    <param name="quality" value="high" />
    <!-- Sandwich the embed tag inside the object tag -->
    <embed src="myclip.swf" quality="high" />
</object>
<object width="400" height="400" data="helloworld.swf"></object>

This will work on all browser, although I will suggest you to avoid using <embed> tag, as Firefox doesn't support that. You can learn more about <object> tag from link below.

http://www.w3schools.com/tags/tag_object.asp

I think it works quite reliably with an <iframe> .

<iframe src="myclip.swf" width="300" height="200" border="0" />

http://jsfiddle.net/ZZ5Pk/ (Warning: Loud SWF)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM