Getting HTML5 to work on Chrome

I managed to get a project to work on Firefox (both standard and Nightly), but whenever I run it on Chrome the “Downloading…” bar fills up and then it hangs and nothing happens. However, Tappy Bird does work on Chrome, which means it should be possible. What do I need to do to get this working?

For things to work on chrome, the files need to hosted behind a web server, chrome doesn’t like direct file system access. html - File Url Cross Domain Issue in Chrome- Unexpected - Stack Overflow.

if things happens on time, this shouldn’t be an issue for the next release were we always host files via a built in webserver.

I did open the game through XAMPP.

Could you post some other information - console output? Could you also try on Chrome beta - Try New Features with Google Chrome Beta - Google Chrome

I’m in the same situation as alextoinescu. I run my project through Apache and it works on Firefox, but when I try to run it on Chrome (36.0.1985.143 m) the browser stops right after the ‘Downloading data…’ bar gets completed.

The Javascript console shows this error: Uncaught RangeError: Invalid typed array length in localhost/UE4Game-HTML5-Shipping.js.

This is where the code breaks: HEAP8 = new Int8Array(buffer);

That particular error is to do with chrome not able to completely allocate the total memory required.

So, for HTML5 - we have to allocate all the memory the game is going to use before hand. 32 bit browsers can only provide that much.64 bit browsers can provide a lot more. this done through setting Module.TOTAL_MEMORY in the Game.html page.

either you can edit that value or set right amount in HTML5Engine.ini file ( BuildSetting ). Look at HTML5Platform.Automation.cs line 68 on how that value is set during packaging.

For 32 bit browsers - The most i have seen safely being allocated is 512 MB. if your game needs more than, I would think you are out of luck for 32 bit browsers. You might want to cherry pick this changelist to clamp values automatically for 32 bit browsers.

I think, You should do some experimentation and actually figure out the high watermark for memory usage - discussion about emscripten memory profiling and use that number in the .ini file for your HTML5 builds.

Thank you Ankitkk. It worked. Now Chrome and Firefox run our project.

Hey Ankikk, i got a problem my project " http://hg2d.net/vitualisation/HTML5/Package.html " dont work on chrome / maxthon browser.

I change .TOTAL_MEMORY in .html 1Go too 3Go for the test but dont work.

when i go in HTML5engine.ini at buildsetting i saw that :


[OnlineSubsystemMcp]
benabled=false

[SystemSettings]
r.setres=800x600

[BuildSettings]
HeapSize=1024

[HTML5DevicesWindows]
Firefox Nightly (64 bit)=“C:/Program Files/Nightly/firefox.exe”
Firefox Nightly (32 bit)=“C:/Program Files (x86)/Nightly/firefox.exe”
Firefox (32 bit)=“C:/Program Files (x86)/Mozilla Firefox/firefox.exe”
Firefox Aurora (32 bit)=“C:/Program Files (x86)/Aurora/firefox.exe”
Chrome=“C:/Program Files (x86)/Google/Chrome/Application/chrome.exe”

;all browsers on mac are 64 bit, 64 bit browsers can allocate more than 512MB of memory to around 1.5 GB.
[HTML5DevicesMac]
Safari=“/Applications/Safari.app/Contents/MacOS/Safari”
Firefox=“/Applications/Firefox.app/Contents/MacOS/firefox-bin”
Firefox (Aurora)=“/Applications/FirefoxAurora.app/Contents/MacOS/firefox-bin”

[HTML5DevicesLinux]
Firefox=“/usr/bin/firefox”

[HTML5SDKPaths]
Mac=“/path/to/emscripten/sdk”


if i follow your advice i have to change Heapsize … but i dont understand with what.

Can you help me ?

how did u soveld this ?