How to embed a SWF file in an HTML page?
The best approach to embed a SWF into an HTML page is to use SWFObject.
It is a simple open-source JavaScript library that is easy-to-use and standards-friendly method to embed Flash content.
It also offers Flash player version detection. If the user does not have the version of Flash required or has JavaScript disabled, they will see an alternate content. You can also use this library to trigger a Flash player upgrade. Once the user has upgraded, they will be redirected back to the page.
An example from the documentation:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>SWFObject dynamic embed - step 3</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<script type="text/javascript" src="swfobject.js"></script>
<script type="text/javascript">
swfobject.embedSWF("myContent.swf", "myContent", "300", "120", "9.0.0");
</script>
</head>
<body>
<div id="myContent">
<p>Alternative content</p>
</div>
</body>
</html>
A good tool to use along with this is the SWFObject HTML and JavaScript generator. It basically generates the HTML and JavaScript you need to embed the Flash using SWFObject. Comes with a very simple UI for you to input your parameters.
It Is highly recommended and very simple to use.
Embed Local .swf File in HTML
Use embed in your HTML code :
<embed src="myFile.swf" height="800px" width="600px">
source tutorial: html5 embed flash element
How to embed a swf file into html code?
Use SWFObject:
http://code.google.com/p/swfobject/wiki/documentation
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>SWFObject dynamic embed - step 3</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<script type="text/javascript" src="swfobject.js"></script>
<script type="text/javascript">
swfobject.embedSWF("myContent.swf", "myContent", "300", "120", "9.0.0");
</script>
</head>
<body>
<div id="myContent">
<p>Alternative content</p>
</div>
</body>
</html>
Embedding SWF file in HTML5 - How to add alternative content?
Use the object tag instead of the embed tag like so: <object width="550" height="400" data="main.swf">Alertnative Content Here</object>
See: EMBED vs. OBJECT
What's the ultimate way to embed Flash (swf) files to HTML (and XHTML) documents?
Here it is:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<title></title>
<script type="text/javascript" src="swfobject.js"> </script>
<script type="text/javascript">
swfobject.embedSWF('test.swf', 'myFlash', '320', '240', '9.0.0', '/swfobject/expressInstall.swf', 0, 0, 0);
</script>
</head>
<body>
<div>
<object id="myFlash" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="320" height="240">
<param name="movie" value="test.swf">
<!--[if !IE]>-->
<object type="application/x-shockwave-flash" data="test.swf" width="320" height="240">
<!--<![endif]-->
<p>Version ???</p>
<!--[if !IE]>-->
</object>
<!--<![endif]-->
</object>
</div>
</body>
</html>
- I combine the static and dynamic methods of SWFObject
- The static part is using the nested-objects method
What is the best way to embed swf into html page
You can try swfobject: https://github.com/swfobject/swfobject.
It`s very simple to add Flash and Flashvars.
Here with 100%:
http://learnswfobject.com/advanced-topics/100-width-and-height-in-browser/
swfobject.embedSWF("test.swf", "flashContent", "100%", "100%", "9.0.0", false, flashvars, params, attributes);
How to embed a swf file and link it to another page using HTML?
<div onmousedown="window.location.href='new_location'">
<object>
<param name="movie" value="3.swf">
<param name="wmode" value="transparent" />
<embed wmode=transparent allowfullscreen="true" allowscriptaccess="always" src="3.swf"></embed>
</object>
</div>
Related Topics
Bootstrap 4 - Responsive Cards in Card-Columns
How to Set an Image's Width and Height Without Stretching It
Which Is More Correct: <H1><A>...</A></H1> or <A><H1>...</H1></A>
Html5 Video Element Request Stay Pending Forever (On Chrome)
How to Center List Items Inside a Ul Element
Why Is the Span's Line-Height Useless
How to Align Entire HTML Body to the Center
iOS 11 Safari Bootstrap Modal Text Area Outside of Cursor
How to Disable Form Fields Using CSS
Table Scroll with HTML and CSS
Adding a Background Image to a <Div> Element
How to Select a Radio Button by Default
Should Image Size Be Defined in the Img Tag Height/Width Attributes or in CSS
Allow Specific Tag to Override Overflow:Hidden
Retrieve Image from Ftp to Webpage
Is It Alright to Use Multiple H1 Tags on the Same Page, But Style Them Differently