I am trying to open up a new tab using javascript. It doesn't work and I get the error:
[Error] SyntaxError: Unexpected token ':'. Expected ')' to end an argument list.
(anonymous function)
Here is my code:
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();
Thanks!