Using: html5.run("window.open('...')") --Popup Blocked?

Hi,

Running the following command on HTML5 version has issues:

html5.run("window.open('https://play.google.com/store/apps/details?id=com.fallenangelsoftware.redlightracer')")

On Windows 10

  • Microsoft Edge: Popup blocked
  • Mozilla Firefox: Popup blocked
  • Google Chrome: OK (opens in new tab)
  • Opera browser: Popup blocked

How can I fix the issues above, thanks!

Jesse

This is an issue with the browsers, and probably a security thing, nothing we can circumvent from Defold.

But it might be worth noting that such a call should be triggered from inside a on_input function, since some browsers will block certain actions that does not occur during input events.

Try this trick:

it works ok in html5 version of my game: http://dragosha.com/hamster/ (see html code here: https://github.com/Dragosha/Dragosha/blob/master/hamster/index.html)

Main thing is calling url opening function when user make a click.

1 Like