简体   繁体   中英

Opening url in new tab from dropdown select

I have this and i can't get it to work on Safari for OS X (Safari 8.0). It works on Firefox and Chrome but i simply cannot get it to work in Safari.

function myChangeHandler() 
{
window.open(this.options[this.selectedIndex].getAttribute('value'), '_blank');
this.form.submit();
}

What am i missing?

Thanks

I'm not sure what doesn't work since there is no specific problem that is posted but I'm guessing it's the window.open()?

I found this article

window.open(url, '_blank'); not working on iMac/Safari

it might be the one you were looking for.


From: Kelly J Andrews

The standard window.open() JavaScript method cannot be used to open a new tab and window from a global HTML file or an extension bar. Instead, the global file and extension bars have access to the SafariApplication, SafariBrowserWindow, and SafariBrowserTab classes, whose methods and properties allow you to work with windows and tabs.

It goes on to explain how you can use

var newTab = safari.self.browserWindow.openTab();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM