iOS Safari window.open not working when clicked a 3D button

I have a few 3D Button, it was actually a 3D entity with collision, i used ray-cast to pick those object on touch or mouse down event, after clicked 3D button, it would fire an event, and the event will call another function open() to implement the window.open().

However, it only works when click on a 2D button element. the 3D button fire event is not working at all even both 2D button and 3D button are calling the same function.

Any suggestions ?

window.open is not supported on Safari Window.open() - Web APIs | MDN

Check Stackoverflow for workarounds on this. I think you might be able to create a <a> DOM element and invoke click on it.

1 Like

Hi @Calvin2274 and welcom! The 2D button works on Safari on my iPhone. The 3D button is not working. Can you share an editor link so someone can take a look?

Thank you.

That’s wired. How come the 2D button works with window.open on iOS Safari but 3D button not working then.

Actually i created a button element and invoked the click()
Will try the DOM element

Tried a element. got his error on iOS Safari

Refused to display ‘https://www.google.com/’ in a frame because it set ‘X-Frame-Options’ to ‘SAMEORIGIN’.

What method are you currently using to detect if a 3D entity has been clicked? I think using a raycast is the most common way. You will find some more information on the page below.

https://developer.playcanvas.com/en/tutorials/entity-picking/

Collision picking.

but finally, i found another solutions from here:
https://developer.playcanvas.com/en/tutorials/world-to-ui-screen-space/

Since only a 2d button works to call window.open(), i tried no longer using collision picking, instead using a hidden UI button on 2D screen and make it follow a target of 3D entity.

If window.open() works with a 2D entity it should also work with a 3D entity. I think there was something wrong with the set up of your collision picking.