Safari will load html5 project with swf asset from a server but not local


#1

I build html5 projects that use an Animate/Flash swf file as an asset. Those projects are loaded onto a web server and I can run them using Safari. But Safari won’t run my copy stored locally on the machine. From testing it seems that Safari won’t load the swf file even after I use Disable Local File Restrictions in Safari’s Develop menu. I have no problem running the local version using Firefox.

I’ve seen other posts that had problems with loading local files but they don’t seem to apply to my question.

What do I need to do so Safari will load and run my local version of my projects.

Thanks in advance.


#2

Are you running the openfl test html5 command (where we boot a local webserver) or are you trying to test it locally a different way?


#3

I’m just opening the index.html file that is created with the browser.


#4

If openfl test html5 is inconvenient, you can use openfl test html5 -nolaunch and it will build and start the HTTP server, but not launch your browser, which may be better for reloading


#5

I don’t use any command lines. I use Visual Studio Code to create and organzine all the source files and assets. I use the Run Build Task command which invokes “lime: build html5” and if the build is successful, I find the associated index.html and open it with a browser.

I just tried the Run Task command and selected “lime: test html5” which for one project successfully started Safari which did open that project web page. Opening it directly with Safari didn’t work. But for several others I got this:

Executing task: lime test html5 --connect 6001 <

events.js:72
throw er; // Unhandled ‘error’ event
^
Error: listen EADDRINUSE
at errnoException (net.js:904:11)
at Server._listen2 (net.js:1042:14)
at listen (net.js:1064:10)
at net.js:1146:9
at dns.js:72:18
at process._tickCallback (node.js:419:13)
at Function.Module.runMain (module.js:499:11)
at startup (node.js:119:16)
at node.js:906:3
The terminal process terminated with exit code: 1

I double checked and all of them built without errors using the Run Build Task command. I tried changing the default app for an html file to Firefox and still got the same error. And the errors listed are identical for each project, even the numbers .e.g. at errnoException (net.js:904:11)

Would really like to test my projects locally since I’m seeing differences in the vertical positioning of dynamic text fields between Safari and Firefox.


#6

If the default port we use for the HTML5 dev server (3000) is in use, you can add --port=3001 or another port value to your test command. Another option is to run the openfl run html5 command, which will start the server, and keep it running. Then you can use openfl build html5 separately