Export game with scripts

Hi fellows,
I encountered a problem when I try to export my game to the web. Before I started adding javascript events and external js-files I was able to run the game in the browser right from the filesystem without the need of a webserver.
So I was able to pack the exported game into a click package and run the game as an offline webapp on ubuntu touch mobile os.
But since I included javascript the game only runs with a running webserver so the app doesn’t run locally on the phone anymore.
Is there any workaround so that I can run the webapp offline again and still use javascript?

Error message when run offline:

[code]code.js:13
Pixi.js 3.0.8 - ✰ WebGL ✰ http://www.pixijs.com/ :heart::heart::heart:

bunny.png Failed to load resource: net::ERR_FILE_NOT_FOUND
code.js:11 Uncaught DOMException: Failed to execute ‘texImage2D’ on ‘WebGLRenderingContext’: The image element contains cross-origin data, and may not be loaded.
at i.updateTexture (file:///home/matthias/Gemeinsames/GemeinsameDateien/Entwicklung/gdevelop_projects/sakawochi/click/www/code.js:11:6391)
at i.renderBatch (file:///home/matthias/Gemeinsames/GemeinsameDateien/Entwicklung/gdevelop_projects/sakawochi/click/www/code.js:12:20171)
at i.flush (file:///home/matthias/Gemeinsames/GemeinsameDateien/Entwicklung/gdevelop_projects/sakawochi/click/www/code.js:12:19618)
at i.renderDisplayObject (file:///home/matthias/Gemeinsames/GemeinsameDateien/Entwicklung/gdevelop_projects/sakawochi/click/www/code.js:11:5437)
at i.render (file:///home/matthias/Gemeinsames/GemeinsameDateien/Entwicklung/gdevelop_projects/sakawochi/click/www/code.js:11:5219)
at gdjs.RuntimeScenePixiRenderer.render (file:///home/matthias/Gemeinsames/GemeinsameDateien/Entwicklung/gdevelop_projects/sakawochi/click/www/code.js:16:13588)
at gdjs.RuntimeScene.render (file:///home/matthias/Gemeinsames/GemeinsameDateien/Entwicklung/gdevelop_projects/sakawochi/click/www/code.js:2:10300)
at gdjs.RuntimeScene.renderAndStep (file:///home/matthias/Gemeinsames/GemeinsameDateien/Entwicklung/gdevelop_projects/sakawochi/click/www/code.js:2:10174)
at gdjs.SceneStack.step (file:///home/matthias/Gemeinsames/GemeinsameDateien/Entwicklung/gdevelop_projects/sakawochi/click/www/code.js:2:17908)
at file:///home/matthias/Gemeinsames/GemeinsameDateien/Entwicklung/gdevelop_projects/sakawochi/click/www/code.js:2:31627[/code]

I thought Ubuntu Touch is dead :astonished:

I’m not an expert on this but from what I know it means you are running your app through https but trying to access data through http or the other way around, running the app through http and trying to access something through https.

So, the only thing I can recommend to try is that if you point or link to any external resources, try using only http or only https or in case you are pointing to any local resources with file:// try using localhost/ instead.

Thanks ddabrahim for your quick answer.
I got it working again. Looks like it wasn’t the javascript after all. I used a template for the permissions and removed some predefined permissions a couple of days ago from which I thought they were not needed. Looks like the “video” permission is needed to run html5 games on ubuntu touch. After adding it again it runs, yay. :slight_smile:

Concerning ubuntu touch:
Canonical gave up on the project about a year ago but some developers were found that adopted it. Currently ubuntu touch is run by UBPorts as a community project and it seams to be striving. They are posting status updates every second saturday on youtube. Here is the currend video in which they demonstrate the convergence function:
https://www.youtube.com/watch?v=4qCERv8jYOY
They are also working on “Anbox” integration to run android apps in the upcoming ubuntu touch 16.04. When the “Halium” abstraction layer gets integrated ubuntu touch will also run on a lot more android devices by utilizing the android hardware drivers.