Hi⦠I have the following script applied to an object, and it works perfectly on desktop browsers (other than Safari) and it works perfectly on Android, but it doesnāt function at all on any browsers on iOS.
import { IPointerClickHandler, PointerEventData } from "@needle-tools/engine/src/engine-components/ui/PointerEvents";
export class openUrlCartoonfun extends Behaviour implements IPointerClickHandler {
// Make sure to have an ObjectRaycaster component in the parent hierarchy
onPointerClick(_args: PointerEventData) {
console.log("Clicked", this.name);
window.open("https://www.cartoonfun.co.uk");
}
}```
Does anyone have any ideas (other than ' š š Safari' ) as to what the problem might be?
It's not a deal-breaker... but it'd be cool to find out what's wrong and if there's a workaround š
[Original Post on Discord](https://discord.com/channels/717429793926283276/1086988693883072634)
*by user 908977119781060648*
Sorry for missing this question!
Can you try
setTimeout(() => {
window.open('https://www.cartoonfun.co.uk', '_blank');
});
instead of just window.open
?
Hi @herbstā:cactus: and many thanks for replying, itās much appreciated 
I gave that a go but sadly it didnāt make a difference.
In Safari on desktop, clicking the link in the scene throws a āPopup window blockedā notification in the URL bar (plus an option to click on an icon there to open the requested window). Itās not ideal but at least someone can visit the link in question if they know to click on the icon in the URL bar.
In Safari on iOS, clicking the link in the scene simply doesnāt do anything at all. No notification/explanation. No options to open the requested window. Nothing 
Any ideas and suggestions will be very gratefully received! 
by user 908977119781060648
Incidentally⦠I know youāll already know this but the Needle logo thatās sited in the bottom right hand corner of published scenes works perfectly across all browsers and platforms. When clicked it seamlessly takes users to needle.tools as expected 
So, I was wondering, might it be possible to employ whatever makes that work for other links too (like the one Iām experiencing difficulties with)⦠and, if so, how might I achieve that?

by user 908977119781060648
This is literally a link element
You can also try this;
let link = document.createElement("a");
link.href = 'https://www.cartoonfun.co.uk';
link.target = '_blank';
// document.body.appendChild(link); // may not be needed
// link.style.visible = 'none';
link.click();
Oooooo, cheers⦠Iāll see if I can implement that. Many thanks!!!
by user 908977119781060648
Just use it in place of your window.open
call! Let me know how it goes 
still no joy.
I used thisā¦
import { IPointerClickHandler, PointerEventData } from "@needle-tools/engine/engine-components/ui/PointerEvents";
export class openUrlCartoonfun extends Behaviour implements IPointerClickHandler {
// Make sure to have an ObjectRaycaster component in the parent hierarchy
onPointerClick(_args: PointerEventData) {
console.log("Clicked", this.name);
let link = document.createElement("a");
link.href = 'https://www.cartoonfun.co.uk';
link.target = '_blank';
// document.body.appendChild(link); // may not be needed
// link.style.visible = 'none';
link.click();
}
}```
... but it still doesn't make any difference. It seems Safari isn't interested in playing nice š
*by user 908977119781060648*
can you uncomment the two lines I had added commented?
just to be sure, you do get the āClickedā log right? and it works on Android?
Yup, āClickedā is confirmed⦠and it works just fine on Android.
Two tics, Iāll uncomment the lines and try again.
Thanks for all your help with this!
by user 908977119781060648
Nope, not a goer. Iām now getting a āPre Build Script failedā notification and the console says,
āsrc/scripts/OpenUrlCartoonfun.ts(13,20): error TS2339: Property āvisibleā does not exist on type āCSSStyleDeclarationā.ā
Thanks for the suggestions, though. Theyāre greatly appreciated. Apologies but Iām afraid Iāll have to look at all this again tomorrow as I have to dash off to get some deadline stuff done just at the moment 
by user 908977119781060648
Sorted

As it seemed to be the opening of a new window that was causing the problems, I edited window.open('https://www.cartoonfun.co.uk');
to read window.open('https://www.cartoonfun.co.uk', '_self');
and Safari likes it 
So⦠this works 
import { IPointerClickHandler, PointerEventData } from "@needle-tools/engine/src/engine-components/ui/PointerEvents";
export class openUrlCartoonfun extends Behaviour implements IPointerClickHandler {
// Make sure to have an ObjectRaycaster component in the parent hierarchy
onPointerClick(_args: PointerEventData) {
console.log("Clicked", this.name);
window.open('https://www.cartoonfun.co.uk', '_self');
}
}```
It's not an ideal solution as users are taken away from the scene content if they visit a link... but it does function so I'm banking that š
š
*by user 908977119781060648*
1 Like
Ah nice! So itās basically Safariās aggressive popup blocking that prevents it. Good to know, and glad you were able to figure it out!
@herbstšµ heyo any wait to not have ā_selfā?
by user 263967078346653697
for safari
by user 263967078346653697
or is self the only way for now
by user 263967078346653697
My understanding is that Safari blocks popups by default and users have to actively allow specific webpages to use popups. So Iād recommend using the above-mentioned approach to avoid your links being blocked by Safari.
got it
by user 263967078346653697
is there any way to check in script or smth
by user 263967078346653697