- Home /
Deployable Offline WebGL Solution
We're developing an application which MUST be run through a browser. It has various components which communicate with one another through JavaScript calls, each of which is embedded in the web page along with other content.
The application must be multiplatform, deploying to desktop, iOS and android.
Also, we require that the application have the capability of running locally (as well as from a server).
We don't want to force our users to configure Chrome or IE to allow file access (which in turn will allow WebGL builds to run offline), and we also don't want to force our users to use Firefox.
Is there some other solution to this? Modifying UnityLoader.js to load assets in a different way perhaps?
Answer by Bunny83 · Jun 24, 2016 at 07:52 PM
Uhm, i don't quite get the problem i guess. If you open a website from a local folder the website has access to that folder and it's subfolders as long as you're using relative URL paths.
For example i've made this mandelbrot renderer in Unity and deployed it as WebGL into my public dropbox folder. I can run the index.html using the dropbox link, but i'm also able to just open it locally.
However i'm using FireFox only. If it doesn't work in your browser then it's a pure browser specific problem. The assets are packed into binary files. If the browser is blocking those your only options are either using a different browser or try to change the security settings of your browser. A Unity WebGL build consists only of 5 files in total. If the browser is only blocking those when loaded from a local folder it's the browsers fault.
If you want to file a complaint you probably should direct it to your browser manufacturer who is unable to provide a secure local access for a locally hosted webpage. It seems ridiculous to allow the loading and parsing of binary files from an arbitrary internet location but blocking them when loaded from a local folder. How could that be more dangerous? As long as the access is restricted to that folder / subfolder i don't see any problem. Crossdomain restrictions should apply there as well.
To answer your last question: No, i don't think there's a workaround. The Unity engine core works the way it does and it needs the files the way they are.
Your answer
Follow this Question
Related Questions
Distribute terrain in zones 3 Answers
How to profile a WebGL app using the unity profiler tool? 0 Answers
when build to webGL 0 Answers