473,396 Members | 2,087 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

window.addeventlistener in google chrome

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
0 6074

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

Similar topics

6
by: lukeo | last post by:
I'm shelling out to an .asp (or htm) page from an application. I want to show this in a window without the address bar, etc... Is there a way I can redirect this page using javascript to a page...
3
by: Chris | last post by:
Hi I have designed my website to fit my standard windows. I use a javascript scroller that nescitates the removal of the browser scroll bars. However if a user has an extra toolbar open in...
3
by: Robert Atkinson | last post by:
Does anyone know how to replace <a href="url" target="_blank"> with window.open, keeping the window settings the same, i.e. same size, same toolbars, etc. I've tried document.open, and...
32
by: Eli | last post by:
How can I POST a form into a new window where I control the size and other attributes of the new window? Also. Are there any implications, perhaps due to browser security (Interne Explorer?)...
2
by: Peter | last post by:
I would like to automatically resize a window to its content. I was thinking of using an outer table to detect the size of my content, then use window.resizeTo( ). The problem is I'm not sure...
8
by: Dominic Tocci | last post by:
I'm searching for a way to use window.open on my web page to open a window in firefox that allows the sidebars to work (bookmarks, history, etc). When I use the following: var...
6
by: Daz | last post by:
Hello everyone, I would like to open a child window from the parent, and add an onload event listener to the child window which will tell the parent when the document has loaded. As far as I...
20
by: Mark Anderson | last post by:
Hi, I have this in an external JS library: ///////////////////////// function addMyEvent(){ var obj; if(document.attachEvent) { obj = document.getElementsByTagName('img'); for...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.