html - The proper way to handle popup closing -
I am looking for a close event for popup. I've got one, but I need it for HTML.
The property has closed
in the popup.
& gt; & Gt; & Gt; Var popup = open ('http://example.com/', 'popup', 'height = 400, width = 500'); & Gt; & Gt; & Gt; Popup.closed false
Well, I can do it.
function open_popup () {var popup = open ('http://example.com/', 'popup', 'height = 450, width = 450'); Var timer = setInterval (function () {if (popup.closed) {warning ('popup off!'); Clear interval (timer);}}, 500); }
I tested it on Chrome 4.0.249.27, Opera 10.10, Safari 4.0.4 and Firefox 3.5.5. All work is fine.
But Set Interlude Me Distress Is It Ugly Is A Better Way To Do It?
Update: I use Popup for authentication dialog (in fact, oAuth). I want to send some messages after the popup is closed (via post message).
Page inside popup from any other domain. Therefore, I can not add any event ( unload
) due to security restrictions.
Can not use IFrame due to IFrame buster script. Therefore, I can not use any fancy jQuery model communication.
I can not edit some inside the popup.
You want to look at the unload
event, but take a look
Edit : As you have said that you can not edit anything inside the popup, there is actually no option left. I believe your current SetInterval
code fixes the job You should ask yourself if the real-time address of popup ending is very important 500 milliseconds The d-timer will certainly not weaken any resources or bring any computer to its knees.
Comments
Post a Comment