Gary Rosenzweig's

Developer Dispatch

News and Notes For Developers Using Flash, ActionScript, Director, PHP and JavaScript.


MY BLOGS
Developer Dispatch Blog
Flash Game U
iPhone Dispatch Blog
INFO & FEEDBACK
About Developer Dispatch
About Gary Rosenzweig
Gary Rosenzweig's Books
Feedback
Contact Gary Rosenzweig
SHARING
Add to Technorati Favorites
Add to Del.icio.us
Stumble Upon
LINKS TO MY SITES
CleverMedia
Fun Games at GameScene.com
MacMost
Director Online
LINKS TO MY FRIENDS
Tech Support from Ask Dave Taylor
Ask Leo
Amy Gahran
Custom Stickers
Dean's Director Tutorials
Flash Website Templates
Time 4 Learning
RSS FEEDS
Raw RSS
Add RSS to your My Yahoo


09/16/04

Detecting Pop-Up Blockers

I was recently adding functionality on one of our sites that included having Shockwave and Flash movies pop open a a new browser window. I wanted the window to be a certain size, so I had the movies call a JavaScript function on the page to do the window creation. The problem was that many pop-up blockers would incorrectly kill this window, even though it was not an ad.
So I needed a way to get around the pop-up blockers, or at least inform the user that their pop-up blocker was interefering with the function that had requested. I found a lot of good information here: http://www.popup-killer-review.com/detector.htm.
Basically, the idea is to use window.open to pop open the window. Then set a timeout to check for the window’s existance a second later. If the window doesn’t exist, then the window creation was blocked. I then use a window.alert to tell the user about it. They can then turn off their pop-up blocker, maybe just for this one site, and click on the button again to try to open the window.
The code for doing this can be found on that page, but only if you view the source. Not sure why it isn’t detailed more in the article.


Leave a Reply