window.onload DOM loading in popup, browser compatibility

Posted by user1477508 on Stack Overflow See other posts from Stack Overflow or by user1477508
Published on 2012-10-20T22:07:17Z Indexed on 2012/10/20 23:01 UTC
Read the original article Hit count: 136

Filed under:
|
|
|

I have HTML popup window and i want add text after opening window with spec. function:

var win = window.open('private.php', data.sender_id , 'width=300,height=400');                      
win.window.onload = function() {
         //function for add text
         //chrome and firefox fire, IE and Opera not
};

This work perfectly with Chrome and Firefox, but Opera and IE9 won't working. Please tell me best way to do that with IE and Opera. I try with:

$(document).ready(function(){
   //function for add text
});

but same thing.

I found solution, but i wont know is there better solution then setTimeout???

Instead onload event i use:

setTimeout(function(){
 //add text
},200);

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery