I know someone else asked this recently, but I haven't seen an answer up 开发者_如何学Gothere yet. I have a popup music player working with a WordPress website. Getting it to work was tricky and now I'm told the client sees it loading as a tab instead of a new window, which he absolutely won't accept. I wonder if there is absolutely no way to make this work?
function popUp() {
var popup=window.open('http://websitehere.com?id=somevar&more=anothervar','','width=495,height=250,scrollbars=0');
}
And here's the call, in a link:
<a href="javascript:popUp();"><img src="theimage.png"></a>
Am I doing something wrong? Is there better popup code out there? Thanks!
No. Whether window.open()
opens the url in a new window or a new tab is controlled by the user's browser's preferences, and cannot be overridden.
You can put it in an object element, or an iframe, in a div tricked out to look and act like a draggable, closable 'window'. Wait'll the client finds out some setups prevent any new windows being opened via script.
精彩评论