Search code examples
javascriptjqueryhtmlflash

How can I force swf files to be run, not downloaded


For example, I want to make an iframe to this url: http://example.com/game.swf

The problem is, users who are on different browsers/devices/settings have the issue where instead of running the swf, the browser is just downloading it.

Keep in mind, I don't have access to the code for http://example.com, or the fla file. I need to use the iframe hack because of some issues with the swf.


Solution

  • The iframe must load an HTML file, instead of directly loading some SWF file. So get around that rule by embedding SWF within the same html that the iFrame will be loading.

    If iframe has code:

    <iframe src="http://example.com/game.html"> </iframe>
    

    Then in game.html have code:

    <!DOCTYPE html>
    <html>
    <body>
    
    <embed src="http://example.com/game.swf" width="800" height="600">
    
    </body>
    </html>