Execute script from B4W to local HTML
08 July 2017 14:47
HI All,
I'm still pretty new to all of this, so please excuse my question if it sounds a bit dumb.
I'll be posting 3 questions to help me with my workflow. Here's the first:
Fundamentally, I'd like to know how to send a command (by using JS, or passing it in a URL with a parameter) to the local HTML file.
Here's an example of the scenario…
My canvas is being displayed on a HTML page (let's make it interesting by having it appear in an iFrame).
There's another iFrame next to it showing a HTML source.
So, my objective is to change the iFrame source URL when I click on an object in the scene.
I have no idea how to set this up… I'm presuming we'd start with logic nodes, but maybe a custom JS.
If you know how to do this, please explain it to me, like you would a 10 year old (I'm very new to B4W and JS)
So, what code do I need? How do I structure it? How do I execute it? And how do I bridge between the scene and the local HTML file?
Any pointers would be really useful. Thanks in advance.
All the best
I'm still pretty new to all of this, so please excuse my question if it sounds a bit dumb.
I'll be posting 3 questions to help me with my workflow. Here's the first:
Fundamentally, I'd like to know how to send a command (by using JS, or passing it in a URL with a parameter) to the local HTML file.
Here's an example of the scenario…
My canvas is being displayed on a HTML page (let's make it interesting by having it appear in an iFrame).
There's another iFrame next to it showing a HTML source.
So, my objective is to change the iFrame source URL when I click on an object in the scene.
I have no idea how to set this up… I'm presuming we'd start with logic nodes, but maybe a custom JS.
If you know how to do this, please explain it to me, like you would a 10 year old (I'm very new to B4W and JS)
So, what code do I need? How do I structure it? How do I execute it? And how do I bridge between the scene and the local HTML file?
Any pointers would be really useful. Thanks in advance.
All the best
08 July 2017 17:02
There a logic node that might help you:
The JavaScript Callback Node. This will allow you to execute any JS function with a button press inside you Blend4WEb app.
Have a look at this video to see how this works.
The JavaScript Callback Node. This will allow you to execute any JS function with a button press inside you Blend4WEb app.
Have a look at this video to see how this works.