开发者

How can I detected blocked popups without opening a new window in JavaScript?

开发者 https://www.devze.com 2023-02-09 03:00 出处:网络
I have a scenario where I need to hit an resource handler to retrieve a document. I am doing this by opening a new window with a url of the ashx file. I am binding some events to the onunload event of

I have a scenario where I need to hit an resource handler to retrieve a document. I am doing this by opening a new window with a url of the ashx file. I am binding some events to the onunload event of the window to run after the file download is complete. However, when a browser has popups blocked, my window object is null. Is there开发者_开发百科 a way I can detect this browser setting before I call window.open?


No

But try this

<a href="page.html" target="_blank"
onclick="w=window.open(this.href,this.target,'width=400,height=500'); 
return w?false:true">Popup</a>
0

精彩评论

暂无评论...
验证码 换一张
取 消