Instead of directly loading from the same folder, I wish to load all js, mem from a url instead.
var script = document.createElement('script');
script.src = "<?php echo 'http://127.0.0.1/app/'; ?>AGKPlayer.asm.js";
script.onload = function() {
setTimeout(function() {
(function() {
var memoryInitializer = '<?php echo 'http://127.0.0.1/app/'; ?>AGKPlayer.html.mem';
if (typeof Module['locateFile'] === 'function') {
memoryInitializer = Module['locateFile'](memoryInitializer);
} else if (Module['memoryInitializerPrefixURL']) {
memoryInitializer = Module['memoryInitializerPrefixURL'] + memoryInitializer;
}
var xhr = Module['memoryInitializerRequest'] = new XMLHttpRequest();
xhr.open('GET', memoryInitializer, true);
xhr.responseType = 'arraybuffer';
xhr.send(null);
})();
var script = document.createElement('script');
script.src = "<?php echo 'http://127.0.0.1/app/'; ?>AGKPlayer.js";
document.body.appendChild(script);
}, 1); // delaying even 1ms is enough to allow compilation memory to be reclaimed
};
document.body.appendChild(script);
The url this content will be loaded from has been mod-rewrited and the server has no way to load it directly like it is in the same folder as the url.
Namely something like "http://127.0.0.1/game/GAMEID/".
The problem is how it complain about "Cannot load bytecode file because it was compiled with an old compiler" even though it load fine directly in the same folder with "./AGKPlayer.html.mem" in the javascript.
Unity3d has the ability to define the actual location of the .data file as well.
Is it giving this error because it could not load the .data file?
viewing source and clicking on the javascript line do indeed load all 3 file so the url provided is correct!
Any help appreciated!
UPDATE: any developer?
The main reason is similar to other site hosting games from site like newground...
Error code is: Error: Not Found : http://127.0.0.1/games/xxx/AGKPlayer.data
I guess if a developer give the option to assign the data file...
UPDATE: NVM
I fix it by changing the following in AGKPlayer.js
var xhr=new XMLHttpRequest;xhr.open("GET",packageName,true);
to
var xhr=new XMLHttpRequest;xhr.open("GET",websiteURL+packageName,true);
in http template
var websiteURL = <?php echo 'http://website.com/'; ?>