Blocka
Blocka

Reputation: 125

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

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?

Upvotes: 0

Views: 313

Answers (1)

mplungjan
mplungjan

Reputation: 177885

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>

Upvotes: 1

Related Questions