【发布时间】:2021-12-02 19:53:33
【问题描述】:
我正在尝试使用 javascript 打开一个新选项卡。它不起作用,我收到错误:
[Error] SyntaxError: Unexpected token ':'. Expected ')' to end an argument list.
(anonymous function)
这是我的代码:
function openTab() {
let myUrl = URL(string: "https://google.com")
// This grabs the active window.
SFSafariApplication.getActiveWindow { (activeWindow) in
// Request a new tab on the active window, with the URL we want.
activeWindow?.openTab(with: myUrl, makeActiveIfPossible: true, completionHandler: {_ in
})
}
}
openTab();
谢谢!
【问题讨论】:
标签: javascript safari