Howard Zoopaloopa
Howard Zoopaloopa

Reputation: 3822

IE Not Picking up Blur Event (jQuery)

I did a quick search, but couldn't find a specific solution to this (I'm sure it HAS been answered) but, I need to figure this out...

Anyone know why this won't work in IE?

$(document).ready(function() {
    $(document).blur(function() {
        window.close();
    });
});

And what to do instead? Thanks.

Upvotes: 2

Views: 650

Answers (2)

carillonator
carillonator

Reputation: 4743

try binding the blur to body instead of document

Upvotes: 1

helloandre
helloandre

Reputation: 10721

I'm fairly certain that you can't detect a click outside the window itself, which seems to be what you're trying to do.

I would recommend a dialog box instead of a new window if you want it to close. They have nifty features like loading in whole other pages, and even iframes.

Upvotes: 0

Related Questions