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.

EDITED: renamed project for import convenience , removed unnecessary files.
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
27 March 2018 06:03
i ran the file
Reply to post of user Alexander Romanov
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.

I ran the file and can only see a simple app with no clickable objects that open a page in a new tab.
Is that the right file?Am also trying to create a clickable object that will open url in a new tab.
27 March 2018 14:56
I ran the file and can only see a simple app with no clickable objects that open a page in a new tab.
Is that the right file?Am also trying to create a clickable object that will open url in a new tab.

There should be three clickable diamonds. Click on each causes opening specific webpage in a new tab.

I've updated the project attached to that message for better understanding:
renamed project for import convenience , removed unnecessary files.
Alexander (Blend4Web Team)
twitter
27 March 2018 21:41
Reply to post of user Alexander Romanov
There should be three clickable diamonds. Click on each causes opening specific webpage in a new tab.

I've updated the project attached to that message for better understanding:
renamed project for import convenience , removed unnecessary files.

Maybe am running the file differently.Am a newbie.
I downloaded your zip file,extracted it and opened the blend file then clicke on fast preview.
Is this the right way of opening the file?
Kindly advice if not.
27 March 2018 21:55
wa able to import the file and run it
 
Please register or log in to leave a reply.