url_open_ext

这将在所选目标设备的浏览器上打开指定的URL,或者(如果使用HTML5模块)在当前打开的浏览器中打开。

当您使用 open() 方法时,您指定的 "target" 参数与标准的 JavaScript "name" 值相同,并且您应该知道,除了 "_self" 之外的所有参数都可能导致浏览器被阻止,或者询问用户是否希望允许它。此参数仅在 HTML5 中运行时使用。

有效的目标是:

目标描述
_blankOpens the linked document in a new window or tab (this will not work if pop-ups are being blocked by the user, in which case you can use the clickable_* functions instead).
_selfOpens the linked document in the same frame as it was clicked (this is default).
_parentOpens the linked document in the parent frame.
_topOpens the linked document in the full body of the window.

注意 安装在玩家设备上的杀毒软件可能导致URL无法打开,因此在使用此函数时请注意这一点。

 

语法:

url_open_ext(url, target);

参数类型描述
urlString要链接到的URL(网址)。
targetString这是打开 URL 的目标区域。它仅在使用 HTML5 模块时使用。

 

返回:

N/A

 

例子:

url_open_ext("http://gamemaker.io", "_blank");

这将在新窗口中打开 GameMaker 主页。