Forums

Embed .swf file

Hi,

I am having issues to embed a .swf file into my html template. I have uploaded the file to PythonAnywhere and tried:

< object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="900" height="590"> <param name="movie" value="myfile.swf"> <param name="quality" value="high"> < embed src="/user/dplyr/files/home/dplyr/myfile.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="900" height="590"> < /embed> < /object>

(I put an extra space in the tags not to become one actual embedding in this post!)

The result in my web app is nothing, just empty. It is not like the entire script is crashing because other pieces of the template work fine. The same code works fine if I open it as a standalone html code in my browser (outside of PythonAnywhere) and point the src to the address of the .swf file in my machine.

Is my problem with the src reference or I am missing something else? Thanks for your help!

have you tried opening the browser developer console and checking for any error messages, and also checking the network tab there to see if there were any loading errors? if so please give the details.

In console I just get an error with /favicon.ico not found, which doesn't seem to be relevant. In network tab I also can't see any error in particular, my website, bootstrap.min.css, game-embed.js and favicon.ico (in red) are in the list. Apologies as I am very new to it and may be missing some description. There isn't any printed error in the errors.log file either.

I also checked that the code works well when I point src to the web URL location of the same .swf file. I also tried some variations of the internal src address (/user/dplyr..., /files/home..., dplyr/myfile.swf...) and got the same problem. Is there any chance that PythonAnywhere doesn't allow this type of file to be sourced internally?

You're using a file path (/user/dplyr/files/home/dplyr/myfile.swf) to refer to your swf file. That will work when everything is on the local machine and not going through a web server. For it to work on PythonAnywhere, you will need to use the URL where the swf file is served.

Thanks for the quick answer but can you please clarify?

I would prefer not to point it to the external web URL because it is not under my control and if it is ever removed I wouldn't have the swf running in my website. I manually downloaded the file and uploaded to the files directory of PythonAnywhere expecting to be able to run it for ever.

What do you mean by local machine? I probably used the wrong words but my understanding was that by uploading the file to the files directory of my account I am hosting the file in the PythonAnywhere server and it can be deployed to whoever is accessing my website, the same way it works when I am pointing css files to my statis files directory. I am not sourcing from my local machine if the definition of local machine is my own physical computer.

We do not publish your files on the internet unless you serve them through your web app. You can publish the swf using the static files feature: http://help.pythonanywhere.com/pages/StaticFiles/ and http://help.pythonanywhere.com/pages/DebuggingStaticFiles/

Working now! It can only work from the statics folder and fails if placed anywhere else. Thanks!

Cool. Glad we got there.