this is specific to A-Frame.
I'm creating an a-link from javascript code:
var alinkEl = document.createElement('a-link');
alinkEl.setAttribute('href', 'http://www.facebook.com/share.php?u=https://.../' + folder + fileName);
This does not work:
alinkEl.setAttribute('target', '_blank');
Any hint?
The <a-link>
s are intended for link traversal as far as i know, not for opening new tabs. The component does not have a target
attribute in the schema. Furthermore, the navigation is implemented like this:
navigate: function () {
window.location = this.data.href;
}
So You only change the location of the given window.
portal
shader, and set the pano
attribute:
<a-circle position="0 3.5 -2"
material="shader:portal;pano:_URL_TO_PORTAL_IMAGE"
></a-circle>
If You want it to open a new tab, make Your own component:
AFRAME.registerComponent('foo', {
init: function() {
this.el.addEventListener('click', (e) => {
window.open('https://ebay.com');
})
}
})
And attach it to Your portal:
<a-circle position="0 3.5 -2" material="shader:portal;pano:_URL_TO_PANO"
foo></a-circle>
Working fiddle here.