Walker News

How To Embed SWF In HTML Code Or WordPress Post?

For those who would like to show or add a Shockwave Flash game in the HTML page or blog post, here is a template of code for reference.

Unlike embedding Flash Video file (FLV) in HTML code, the template code used to embed SWF file is relatively “easier” and “simpler”.

Although, it’s still a “satay” of OBJECT tag and EMBED tag, in order to satisfy Microsoft and non-Microsoft web browsers, especially those older versions.

According to Adobe Technote, OBJECT tag is favoured by Internet Explorer 3.0 or later or any web browser that supports Flash ActiveX control, while the EMBED tag is used by Netscape Navigator 2.0 or later or web browsers that use Netscape-compatible plugin version of Flash Player.

Template code for embedding SWF file in HTML code or blog post

1) Upload the SWF file (Shockwave Flash) to web directory. Using WordPress blog as example, this is as simple as uploading an image file in post editor mode.

2) Copy the web path of the uploaded SWF file.

3) Copy and paste the following code into HTML code or blog post editor, update the red-colour text with the web path of uploaded SWF file.

The blue-colour text is optional for change. While the width and height are self-explainable, the id is “nick-name” of the SWF file and it should be unique among embedded SWF files within the single web page.

Note: Don’t simply copy and paste this template code without updating the SWF’s web path, as the hotlinking prevention will stop it from working on your sites.
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab" width="498" height="380" id="test1"> 
<param name="movie" value="http://www.YourDomain.com/YourFile.swf" /><embed src="http://www.YourDomain.net/YourFile.swf" width="498" height="380" name="test1" type="application/x-shockwave-flash" pluginspage="http://www.adobe.com/go/getflashplayer" /></object>


Sample SWF file embedded, with reference to the template code above – A little Shockwave Flash game featuring piano, developed by 100CN.

Custom Search

  1. Rick B 13-10-09@04:46

    Thanks, Just what I was looking for.

    Excellent work.

    Rick

  2. caek7 07-01-10@09:23

    Thanks heaps!

  3. rathab 18-01-10@16:32

    swf embed; doesnt work; i copied yr codes and made a post to my wordpress; itdoesnt work; any ideas

  4. Fariba 06-02-10@05:02

    Hi,
    I tried your code to embed swf into my WordPress page. Somehow, it’s not working.

    Is it because it’s XML driven and the videos and images are in external folders (which by the way are included in the uploaded file)?

    the swf works by itself when I go directly to the swf url (as html page) but not when I embed it in my WordPress file!

    Any thoughts????

  5. Noahdecoco 13-04-10@13:14

    Hey!

    It works great, was just what I’ve been looking for. I’ve been trying out the Kimili plugin for wordpress but didn’t have any luck with that… I wonder why? Anyways, thanks for your post!

    Cheers,

    Noah

  6. Jimmmy 14-04-10@23:07

    Thanks man, you saved my bacon!

  7. Justine 03-05-10@16:31

    Hey! It works! First time lucky. Now quick question – what to do to request that it only plays one time?

  8. Walker 04-05-10@00:02

    I think that control is on the SWF game itself, not the embedding code.

  9. Frost 16-05-10@16:37

    Hi i have i have been trying this in a website named tinierme i have been trying to post swf files on my diary but every attempt i make always ends up in failure i even try the codes that is posted above but no luck ^^ was wondering if anybody can help me on this one thx so much^^

  10. patrick 17-06-10@22:56

    Hi and thanks !

    Works great here…

  11. Derrick 19-07-10@21:26

    Thanx! works great!

  12. nhekborin 11-09-10@15:56

    it doesn’t work with wordpress blog

  13. Trupti 29-09-10@21:18

    I have embeded swf into Html page, but my swf file gets overlapped on the html menu, how can I resolve this issue, guide me please.

  14. luvitsa 04-11-10@22:39

    thank you! worked a treat in wordpress

  15. Aj 15-11-10@14:59

    Thanks , this method works gr8 in WP .

  16. scottybro 27-11-10@09:03

    We tried it, changed the width/height/swf path, all we get is a blank box. The swf file was saved in a different size, we changed it to a smaller size, is that why? Thanks for your help

  17. jimalexanderjr 30-11-10@23:16

    Thanks. Works like a charm.

  18. wormseed 02-12-10@18:49

    Thank you, it helped to implement given banner to WP 2.9 blog ant change banner’s size.

  19. mattc 18-12-10@04:10

    Embedding Flash properly in WordPress posts was such a pain that I wrote a plugin to make it as simple as embedding images. Yes, this is a shameless plug, but I have gotten good feedback from other WordPress users. Hopefully it can make life easier for you, too if you are embedding Flash on your site. The embedding is all XHTML compliant. You can get the plugin here: http://wordpress.org/extend/plugins/swfobj/

    Any feedback is welcome.

  20. Chris 29-12-10@09:06

    Hi there,

    I’m new to HTML, but after I pasted your code into my HTML file and changed the src, width, height, and id values, it still does not show up on my website. When I right-click, the “Movie (is) not loaded…” I’ve placed the .swf in my parent directory (and made sure that the path is correct), so I do not know what is wrong. Any ideas?

    Thank you very much,
    Chris

  21. Walker 29-12-10@10:32

    If you directly paste it link of “src” on web browser, does it works?
    Does the web server has permission to read the swf?

  22. Silver 03-02-11@10:59

    It works fine. But how do make the play and progress bar to show, cos right now I can’t pause or forward it. It just plays the video till it comes to an end

  23. Mike 27-02-11@10:07

    Thanks for the help! This worked liket a charm!

  24. Furkan 09-03-11@05:31

    Thank you very much. I solved my problem thanks to this. Turkish did not have any of this information source.

    Thanks again ..

  25. jackamo 24-03-11@10:39

    Thank you sooooo much this was exactly what I was looking for

  26. Kostas 25-03-11@02:24

    Hello, I tried to use the code above in a text-html widget in the sidebar, but when I clicked save, it automatically transformed to a hyperlink pointing to my .swf file. The same thing happened whith all the variations of the code I found on the Internet. Do you have any idea what is going wrong? Am I missing some security permissions credentials?

  27. Sean 08-04-11@07:35

    Many thanks for your post Walker. A big help.

  28. Danny 17-04-11@03:48

    Hi. i am having a problem with my embeded swf game. i write the code and the game adress right, but it doesn’t play on my site. all i get is a colored background with the height and width i requested.

    can any1 help me?

    Cheers!

  29. Rebecca 06-05-11@14:41

    Holey Moley, that is so sweet easy, thanks!!

  30. Zkitso 17-05-11@17:08

    Man….. thanx for sharing !! Saved me tonight ; )

  31. Elaine 25-05-11@22:59

    Thank you! it was so fast and easy!

  32. Mario 01-06-11@04:50

    Thank you for the code.
    But I have a swf with some external variables in a text file. Could you please help me out with the code if I were to implement this swf along with the var.txt
    I know having the swf along with the txt file in the same root folder is enough, but I don’t know how to access the root folder where the pages are stored.
    Please help, thank you. :)

  33. Y 17-06-11@10:09

    Thank you!!! saved me a ton of work tonight and this worked really well in my wordpress blog!

  34. Dan 08-07-11@02:13

    This was great help! I was able to place this shockwave code on my site. Hats off to you !

  35. Trevor 20-07-11@05:13

    I’ve used two of your posts today with great success. The first was for embedding .flv files and now this. You are a man of many talents. I appreciate you making this information public rather than just sitting on your wealth of knowledge.

  36. Ward Tipton 25-07-11@01:11

    Excellent! Worked like a charm! Thanks!

  37. zed 26-07-11@09:30

    didn’t work! stick in 5% !

  38. Sue 24-08-11@19:49

    I think you deserve a big thanks for this. Helped me out big time! Thank you!

  39. Jane J 31-08-11@05:32

    Just a note to say thankyou – I have been designing some swf to use as a way around the sound restrictions, by linking the sound via the swf to the mp3 on the server, it works on my server, have got the swf on, but am just working now on the file path of the music, thanks once again for posting the info on embedding swf in WordPress blog (post in my case)

  40. Rahul Sharma 08-09-11@18:51

    Hello sir/mam
    I have been trying to embed the swf file in wordpress so please help me i have used these code but i did not get sucess please tell me

  41. Watcher 03-10-11@06:20

    Thx man,its cool :)

  42. Andre 08-10-11@03:41

    thanks sweetheart! :P

  43. Marcel 19-10-11@01:36

    Hey thanks for this code, but when i click on the banner i would like to link some website. what is missing to get a forward to another webpage?

  44. Robert Oakley 24-10-11@04:58

    Thank you. You solved the problem I tried to figure out for some time. Thank you again.
    BTW could you share tips of how to link to another URL from SWF file?

  45. Jeff Devo 23-11-11@00:28

    Thank you, works like a charm.

  46. Rachel 13-12-11@23:08

    Great advice so simple once you know how !
    Worked a treat.

    Many Thanks

  47. Gnob 16-12-11@14:25

    Adding that code was a great help. Thanks a lot!

  48. nakunta 26-12-11@13:45

    Thank you for these great codes! It works well on my wordpress page but not the HTML email (function Mail Subscribers using Subscribe2 HTML). So I wonder what do you mean by “updating the SWF’s web path”?

  49. Naeem 23-01-12@03:53

    Thanks Man.Its Works… :D

  50. Drazen 07-02-12@02:26

    how to disable autoplay of swf file when i embed it in my page on wordpress, tnx!!

  51. Nancie 17-03-12@17:15

    OMG thank you….after trying so many things to get the swf image to work this simple code helped!

    You are a saviour!

  52. Alejandro 23-03-12@06:36

    Thank you! it worked just as i need it! (;

  53. George 22-04-12@20:57

    Thanks a lot! It works perfectly.

  54. Marco 02-06-12@21:31

    Works great with my wordpress! Would you know if it is possible to have it re-size, like a % value instead of pixel value? I have a 1080×1080 swf video, and a dynamic page??

  55. gg 18-06-12@19:12

    this is only for professionals.
    much to complicated!!!!

  56. Tim Reeves 26-07-12@14:47

    WOW, Why can not everyone explain these technical things so simple && straight forward as you have here. You have ended my 3 day experience of trying to install flash on my page……THANK YOU SO MUCH!!!!!!!!!!!!!

  57. Don 07-09-12@02:33

    Thanks for code – works well!

  58. Susi 18-09-12@09:10

    The embed is fine in my blogger unless the swf has an embedded swf in it, then the embedded SWF doesnt play for some reason…any ideas?

  59. Eric 27-09-12@13:32

    How do I insert a URL with the flash object so that when you click on it, it takes you to another website?

  60. Dave 27-09-12@21:43

    Thanks. Good as gold

  61. Karla 02-10-12@02:35

    Thank you so much for this! I’m not a web designer/developer at all. This was so simple and helpful!

  62. Joe 05-11-12@08:51

    Very Good!

  63. Abraham 27-12-12@01:17

    Could you give the code for a dynamic publication of the swf movie?

    Thanks

  64. Preet Singh 20-01-13@11:09

    Thank you so much bro

  65. Nick 31-01-13@00:27

    If this doesn’t work, make sure you check permissions on the swf file, try 775.

  66. kodee 10-05-13@10:31

    thanks, just looking for a simple code like this.
    works fine just the way i want it

  67. Arief Rahzen 09-08-13@01:32

    still works, thanks

  68. TP 05-02-14@05:47

    Thanks dude this worked!

2014  •  Privacy Policy