Jump to content

Open link in a new browser tab.


Skell
 Share

Recommended Posts

 
Prompt method Open link in a new browser tab (that you use in your html5 games)?

 

document.location.href = url; - bad, page opens in the current tab.

 

window.open(url, '_blank');- bad,  require browser permission.

 

 

Link to comment
Share on other sites

You're doing it the right way; unfortunately that's also one of the many ways popups are generated, so it's generally restricted so that an actual link element with target="_blank" (or a button or other purposely interactive element) must be clicked in order to stand a chance of working. The best workaround I can think of is to use a clickable html <a> element positioned above the game canvas.

Link to comment
Share on other sites

The best workaround I can think of is to use a clickable html <a> element positioned above the game canvas.

 

Thanks for your answer.

 

I read on the Internet that use the <div> element with tag "a" . Probably this is the only solution (without restrictions).

 

-----

 

Maybe someone else knows another solution, it would be interesting.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...