I need to embed a swf file into html code. How can I do it?
-
possible duplicate of Best way to embed a SWF file in a html page?Trufa– Trufa2011-04-18 16:34:59 +00:00Commented Apr 18, 2011 at 16:34
-
this site is not ideal for asking this sort of questions. Please take a look at our FAQ. stackoveflow.com/faqTrufa– Trufa2011-04-18 16:52:25 +00:00Commented Apr 18, 2011 at 16:52
Add a comment
|
3 Answers
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>
5 Comments
brianlmerritt
When you posted this, it was correct but SWFObject is now deprecated. So developers would be better to look at the answer from @denislexic
Brad
@brianlmerritt Developers would be better to not use Flash at all these days.
brianlmerritt
Absolutely, but some sites still do - it's a pain!
Brad
@brianlmerritt Sure, and if you're still using Flash, you'll still have no problems with SWFObject. It's as useful now as it was before.
brianlmerritt
Let's let future visitors make up their iwb minds. Hopefully no one else will end up here, but if they do there is now a comment trail that they can follow...
From w3school
<object width="550" height="400">
<param name="movie" value="somefilename.swf">
<embed src="somefilename.swf" width="550" height="400">
</embed>
</object>
More info here
5 Comments
David
As a rule of thumb, W3Schools is considered to be a very poor source of information and referencing it is frowned upon here. I won't downvote you for it, but others might.
Muhammad Imran Tariq
@david I disagree with you. You can see its reputation over the internet. W3schools is really good for HTML/CSS information.
David
@imran tariq: I can see its popularity, but can you cite a source for its reputation? Regardless, in at least this community it's highly discouraged. For reference: meta.stackexchange.com/questions/87678/…
denislexic
@david I'll make a note of it. Thanks.
Bitterblue
I'll vote you up for w3schools. I often use it as quick reference when I need something. I don't learn there but it keeps the things for me I don't want to or can't remember?
You should try using flashobject. It's a Javascript utility that will detect whether the plugin is installed in a cross browser way and replace a given div with the flash object you want.
Update. I see someone else has posted a link to SWFObject. That's what I was looking for when I posted this. You should use that instead. It's more actively developed and maintained.