Alex Moreno
Alex Moreno

Reputation: 729

How to embed a swf file into html code?

I need to embed a swf file into html code. How can I do it?

Upvotes: 1

Views: 50654

Answers (3)

denislexic
denislexic

Reputation: 11342

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

Upvotes: 9

Noufal Ibrahim
Noufal Ibrahim

Reputation: 72735

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.

Upvotes: 0

Brad
Brad

Reputation: 163752

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>

Upvotes: 10

Related Questions