Activating link in VR

,

This is not fully a three.js question, but someone might know.

When I am in a VR experience in a browser in three.js and I activate a link… if it is to another VR experience, it goes there and that is amazing. But if it is to an HTML page that is not a VR experience and I open it in another tab with target=“_blank” for instance, then nothing really happens in the VR experience. The browser window does open in another tab… but we do not see it in VR.

I can press the indented round button and it then shows me the browser inside VR and there is the tab with the page. But is there a way to have it show me the browser with the page inside VR as soon as I press the link?

Another issue is that if I press the link and it opens the tab in the browser that I can’t see because I am in VR… then if I try and go to another VR experience with a different link, it does not work - it no longer goes there. I might be able to solve it by opening the link and then giving the current window focus… like setting the focus() of the VR window after clicking. Because if I go out and close the tab or go to the vr tab then the link works again.

Any thoughts are welcome!

I think It would only work if the site is the same origin and even then, I don’t know how easy it is to automatically re-start the VR when you hit the new page… So you should be able to switch to other pages on your own site with a little work, but linking to a new site will always require the user to grant permissions first.
This is a browser security feature to prevent people from hijacking someones VR experience.

Thanks, @manthrax - yes, going to my own domain in VR keeps me in the experience… I assumed it was going to any VR ready page would keep you in the experience… but have not tried.

The issue is that going to a non-VR page freezes the experience… makes sense. But if you go to the page in a new tab - with target=_blank or whatever… then the experience is fine but then if you try and go to another VR experience, it does not work probably because the new tab has focus.

I did manage to swap the focus back to the VR experience with the following on the experience page:

timeout(.5, ()=>{
	window.focus();
});

but it worked intermittently. When it did work, I was able to go to the next VR experience.

As it stands now, unless I can get the browser to show inside the experience, which it does if I press the indented menu button, then I will rethink opening a browser. Instead, I will bring the information I wanted to show (some code) into the experience itself as an image (when in VR - when not in VR I will go to the code in an online editor).

If anyone has a way to click a link and have the result show in a browser inside the experience… let me know. Cheers.