Comment

Tech Note: The Latest LGF Pages Bookmarklet, With Pop-Up Blocker Detection

11
Birth Control Works5/26/2013 6:04:46 pm PDT

re: #3 Charles Johnson

It turns out to be pretty danged tricky to detect whether a new window has actually opened. Chrome returns a seemingly valid window handle even if the window has been blocked, so you can’t just check for a valid handle.

That’s the purpose of the setTimeout code at line 66 - if the browser is Chrome, it waits long enough for the window to be created, then checks to see if it has a non-zero innerHeight. Kinda kludgy, but it’s the best method I’ve seen.

I love that word: kludgy.