By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,569 Members | 1,394 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,569 IT Pros & Developers. It's quick & easy.

window.addeventlistener in google chrome

P: 1
i have this code which adds an event listener to a newly opened window but it doesn't seem to work in google chrome. the problem is window.addEventListener seem to work in chrome but if you do something like var win = window.open(); win.addEventListener... it doesn't seem to work, see my code below


Expand|Select|Wrap|Line Numbers
  1. exportwin = window.open('ExportScreeningSafetyReport.aspx?qsid=' + qsid + '&title=' + title + (format ? '&format=' + format : ''));
  2. attachEventsMask(exportwin, format);
  3.  
  4. attachEventsMask = function(wins, format)
  5. {
  6.     if (wins.attachEvent)
  7. {
  8.     showWindowMask('', 'Loading...');
  9.     if (format == 'word')
  10.         wins.attachEvent("onbeforeunload", triggerClose );
  11.     else
  12.     {
  13.         wins.attachEvent("onload", triggerClose );
  14.         wins.attachEvent("onbeforeunload", triggerClose );
  15.     }
  16. }
  17. else if (wins.addEventListener)
  18. {
  19.     showWindowMask('', 'Loading...');
  20.     if (format == 'word')
  21.         wins.addEventListener("beforeunload", triggerClose, false);
  22.     else
  23.     {
  24.         wins.addEventListener("load", triggerClose, false);
  25.         wins.addEventListener("beforeunload", triggerClose, false);
  26.     }
  27. }
  28. }
Sep 16 '09 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.