Yes, that’s an issue with Safari on iPhone, not related with PlayCanvas.
I’m not sure if there is anything you can do with JavaScript to address that. The only way is to show some HTML elements that include a clickable a href link for the user to click.
And from there update the html asset with the following HTML:
<div class='button'>BUTTON</div>
<div class='counterBox'>
times clicked <span class='counter'>0</span>
</div>
<div class='text'>
Hit the button to <a href="https://playcanvas.com" target="_blank">increment</a> the counter<br />
</div>
That will make the increment word become a link that opens the playcanvas.com page on a new tab.
Are you trying to do this on a PlayCanvas UI button? If so, you may want to do something similar to Capturing a screenshot | Learn PlayCanvas where we use a HTML element and call click on it.
I am happy to inform you it perfectly worked. Let me show what I did.
Thank you for the help!!
ViewModeManager.prototype.initialize = function() {
// Add a <a> to use to download an image file
var linkElement = document.createElement('a');
linkElement.id = 'link';
window.document.body.appendChild(linkElement);
};
// When the button is clicked, I replaced window.open() with the following codes
var menuAddress = "https://url.address/";
//window.open(menuAddress);
// Thanks https://stackoverflow.com/a/44487883
var link = document.getElementById('link');
link.setAttribute('href', menuAddress);
link.click();