Forum

Opening URL in new window

30 January 2018 21:24
Hi everyone, i am looking to have a new tab open whenever a user clicks on an object. I know to use a page redirect node for opening in the same tab, but is there a solution for opening a new one? I tried following https://www.blend4web.com/en/forums/topic/66/ but cannot replicate the results when i rexport the json from the existing blend file.
Thanks for the help!!
01 February 2018 14:53
Hello! And welcome to our forum!

I've attached an example project. This is a a bit dirty solution. It is not 100% tested on all devices. It is working for me on android with Firefox/Chrome, Ubuntu Firefox/Chrome, ios Chrome/Safari.
Alexander (Blend4Web Team)
twitter
13 February 2018 17:00
Hi Alexander, thank you very much for the reply! I have tried opening the html example in chrome, and it isn't showing anything on my screen (appears completely black), which is strange as i've not had issues with other B4W projects. EDIT: after deploying project and trying the .zip i was able to get the html to work, but only in edge, Chrome displays the loading bar and then stops. Do you know why this might be? Thank you!
13 February 2018 17:28
Press F12 and take a look at the browser console
Alexander (Blend4Web Team)
twitter
13 February 2018 17:34
This is what i get, i think hosting this remotely might fix the cross origin error, but am unsure
"simple_app.min.js?v=13022018092331:1347 Failed to load file:///C:/Users/AMCG/Downloads/simple_app%20(2)/simple_app/assets/simple_app.json?v=_b4w_ver_17_12_0_: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https.
h @ simple_app.min.js?v=13022018092331:1347
simple_app.min.js?v=13022018092331:3 B4W ERROR: empty responce when trying to get assets/simple_app.json?v=_b4w_ver_17_12_0_
f @ simple_app.min.js?v=13022018092331:3
simple_app.min.js?v=13022018092331:2010 b4w load failure
simple_app.min.js?v=13022018092331:1880 Uncaught TypeError: Cannot read property 'shift' of null
at Object.g.update_scheduler (file:///C:/Users/AMCG/Downloads/simple_app%20(2)/simple_app/simple_app.min.js?v=13022018092331:1880:245)
at Object.t.update (file:///C:/Users/AMCG/Downloads/simple_app%20(2)/simple_app/simple_app.min.js?v=13022018092331:1329:131)
at d (file:///C:/Users/AMCG/Downloads/simple_app%20(2)/simple_app/simple_app.min.js?v=13022018092331:1650:378)"


EDIT: Hosting remotely fixed this, locally is still an issue, but it's a start, thank you very much! Just one more question, is it possible to change mouse cursor when hovering over a selectable object (using your JS workaround)
15 February 2018 18:28
requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https.

Do you open the html file directly in your file manager with double-click?

Use project manager for local development. It's based on the tornado server and provides http protocol.
Alexander (Blend4Web Team)
twitter
18 April 2019 14:06
Hello everyone,

I'm trying to solve the similar problem. I want to open url on the new tab after clicking on the object by using combination of nodes and JS Callback. So far a wasn't succesfull. Could someone please look into my test project ? I'm quite a newbie to javascript so i'm not sure what's wrong.

Thank you
 
Please register or log in to leave a reply.