hotlinks from clickable objects

24 October 2014 10:41 #346
being able to open webpages with clickable objects (or sections of the object as clickable for hotlinks and other sections of same object clickable for moving it around) would make for fun online catalogs.
24 October 2014 17:16 #349
This also sounds interesting. Thanks for suggestion!
Blend4Web developer
25 December 2014 20:01 #852
I am told this is possible via API.

I Just had to look up what API stands for.

I would like this feature to the part of the interface, where I can make an object SELECTABLE, have an option to make that SELECTABLE object a HOTLINK and add the URL, and have the standard "open in same window or new window" option. I don't know why the NLA needs to be involved or why I have to mess with API to make this happen, but I have stated my request and I hope B4W Santa hears me!
25 December 2014 22:06 #853
Ok I understand

The feature is very interesting but there are some complications. First, a 3D object is not an HTML element, so we need some method to make it such. Second, there are browsers issues with security, because they try to prevent users from going to ad or malware sites. Sure we can and we will deal with these issues, but I don't know how much time it will take.

Thank your for your patience (and impatience, you know it's very motivating ).
Blend4Web Team
26 December 2014 03:45 #854
loading pages from the same domain would be totally fine, I am not asking for page loads outside of the specific site. I am thinking of a 3d store with products on the shelf and when a product is clicked on, it goes to the static product page. I was able to do this with threejs.
26 December 2014 03:57 #855
this ThreeJS page on my domain, toss a ball at the block hanging in the air, switch to a new page
26 December 2014 10:57 #856
Hi trepaning,

I've made a very simple app (attached to the post) which redirects you to the other page. I think that's pretty much what you've described.
Take a look at example.js. There are just 5 important lines of code in main_canvas_click function.

If you want to open your link in a new tab you may replace the line:
window.location.href = "";


Blend4Web developer
26 December 2014 22:07 #859
That works as expected, thanks.

To add more objects with a variety of URL options in a scene, I simply have to add more lines like this?:

if (obj && == "Cube")
window.location.href = "";
if (obj && == "Plane")
window.location.href = "";
if (obj && == "Sphere")
window.location.href = "";

Again, for my purposes, if it is a security issue that may make links inoperable in some browsers, I do not need pages to open outside of the domain. Other people may require that, but my focus would not, if that helps with a different bit of coding from your end.

As it is, this is great, but of course to stick with the "no coding required" element of B4W, it would be nice to be able to add the links to objects from the Blender interface.
27 December 2014 01:08 #860
Confirmed from my previous post,

To add more objects with a variety of URL options in a scene, add more lines like this:

if (obj && == "Cube")
window.location.href = "";
if (obj && == "Plane")
window.location.href = "";
if (obj && == "Sphere")
window.location.href = "";

However, using localhost to test, the URLs after the primary do not work with Chrome, but do work with IE and FF.

Here is my quick test using the supplied file. Clicking the TEXT will take browser to my site.

I don't have mobile. Do the hotlink clicks register with mobile touch?
27 December 2014 01:51 #861
Hi again

All the objects you are trying to click need to be made selectable in Blender. Also i'd recommend to use get_object_name() function from scenes module to get the name of the object:

if (obj && m_scenes.get_object_name(obj) == "Cube"))

Mobile devices are supported, because click event is also delivered to the required element (canvas)
Blend4Web Team
Please register or log in to leave a reply.