Forum

Unable to find files after build

07 June 2017 19:28
The scene works perfectly fine when launched from Project Manager as Dev or Build, but when the build is opened directly in a browser, it is giving the following error.



Obviously files cannot be found, but I am unable to figure out what has changed since I have made a few scenes that launch properly. This is occurring with all builds now.
07 June 2017 19:42
Any HTML files that require external files like a JSON file needs to run from a server. You have a local server running when you open Blender so you need to open your files from the project manager. If you have a simple HTML export, it is all self contained and no server is needed. So your URL should look something like: http://localhost:6687/projects/whataver.html
08 June 2017 00:09
I am exporting as JSON, and have success with a prior project http://www.trepaning.com/croissEyes/ but now I am getting the above error when opening a build via the Build's HTML. The projects open perfectly fine as both the Dev and Build version when launched from the project manager, but not when opened via the HTML from the respective project's Build folder, which was not an issue before.
08 June 2017 01:41
It is a security feature instituted by the browser to prevent malicious code form accessing local files on your PC. It is not something Blend4Web does. Anybody who develops apps for the browser has to deal with it.
As part of the Blend4Web add-on, a local server is started when you open Blender. The root directory of this local server is your Blend4Web directory. So if you have a project HTML file with a local address of:
file:///C:/blend4web/projects/my_project/my_project.html
You could replace file:///C:/blend4web with http://localhost:6687 and your files could load as long as Blender has your local server running.
Of course, when you run from a production server for the web, the files can load.

08 June 2017 06:59
When I upload one of those builds, it gets an error from the online server as well, it is not just locally.

http://www.trepaning.com/camel/

Again, this project works fine when loaded from B4W's Blender Server for both Dev and Build versions.

The Build version creates the first error when loaded direct to a browser, the project link in this post can reveal the error once uploaded.
08 June 2017 07:27
Hmmm,
Ya something isn't right there.

"B4W ERROR: SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data (parsing JSON http://www.trepaning.com/camel/../assets/camel.json?v=06062017233822)" b4w.simple.min.js:548:671
B4W ERROR: No active scene b4w.simple.min.js:548:671
B4W ERROR: get object troll_rig: not found b4w.simple.min.js:548:671
TypeError: d is undefined[Learn More]

Is the file: http://www.trepaning.com/camel/../assets/camel.json there on the server if you look manually?
08 June 2017 07:39
As per usual, a simple oversight on my part caused confusion and all is well again. I was trying to run the BUILD, which i thought I had done before. However, what I did this time was DEPLOY the project and unzip that and run it, and it works as expected. Thanks for your input, it helped a lot getting me to focus.

http://www.trepaning.com/trump/
08 June 2017 07:58
Ah ya. looks like your animation is working. LOL
 
Please register or log in to leave a reply.