Open hendrasan opened 7 years ago
Chances are, it would get blocked by popup blockers. Those are driven by JavaScript attempting to open new windows or tabs. I'll look into what it would take to add this, though.
+1 on this feature, actually quite important. I also tried many ways to get a link to open a new tab but I couldn't get it working.
Funnily, it is the opposite of general web browsing, where opening new tabs feels unexpected. Now it feels unexpected that clicking a link doesn't open a new tab, and instead closed the VR experience.
Try the last scene of this demo. Hovering the Heart and clicking the GitHub link, it feels unexpected that VR quits, doesn't it? I feel so. Also means links can just be placed in the end of a tour, otherwise when pressing Back the whole VR environment has to restart. https://livetourlab.com/tours/3004
So a big 👍 +1 if it can be solved. :-)
Any updates on this feature? I would love to be able to add linkout CTAs.
We would also need it very soon +1, for this feature request.
This is very easy to implement on your own with Native Modules, but again there's a good chance it can be blocked by popup blockers because browsers do not typically allow JavaScript to open new windows.
Basic pseudocode (untested, but you get the gist):
import {Module} from 'react-360-web';
class CustomLinkingModule extends Module {
constructor() {
super('CustomLinkingModule');
}
openInNewTab(url) {
window.open(url, '_blank');
}
}
Then you can call NativeModules.CustomLinkingModule.openInNewTab('https://example.net')
from React.
This is exactly how I implement it for now. But the browser is blocking the "popup" since the onClick on VrButtons doesn't seems to be a trusted event.
Is there anything we can do about it?
Thumbs up for this request!
https://github.com/facebook/react-360/issues/183#issuecomment-304142112 this satisfied my needs for now.
I have a
VrButton
withonClick
event that doesNativeModules.LinkingManager.openURL('<url>');
and it works.But as I test this on browser (and mobile browser), I'd like the VrButton to open the URL in a new tab. I searched on the documentation and the source code but there's no mention of it.
Is this possible?
Thanks