Click to See Complete Forum and Search --> : window.open() resource hungry


johnadam
11-18-2003, 02:04 AM
I am experiencing PC resource problems when using </b><i>window.open()</i></b> to open multiple browser windows (Windows2000 and IE5.5). The time taken to open a window gets progressively longer. The tenth window takes approx. 5s. If I then open an independent window (for example from a desk top icon) the time is the same as opening the first window. I appreciate that there is some checking going on for the dependent windows but it seems out of all proportion.
<br><br>
I have zipped up two small files which can be used to demo my problem. Use IE to browse to parentPage.html which will open five windows. Time taken to open each window will be displayed. The browser </b><i>Go()</i></b> can be used to open a further five windows.
<br><br>
Is this expected behaviour and if so can I code round it?

Gollum
11-18-2003, 02:43 AM
If you change the reference of time1 to "" in your call to open(), it should work a bit faster...

window.open("childPage.html", "","dep,scrollbars,status,resizable,width=200,height=100,left=20,screenX=10,top=20,screenY=10");

This is because when you put anything but "" in the second argument, the open call must search through all browser windows to see if there is another with the same name.

johnadam
11-18-2003, 02:55 AM
Thanks for that.

I use the window identifier for subsequent window management (to decide which windows to close etc). Any other thoughts?

Gollum
11-18-2003, 04:19 AM
store the references to the windows as global variables...

window.w1 = window.open('page1.html',...);
window.w2 = window.open('page2.html',...);
window.w3 = window.open('page3.html',...);
...

then when you want to close one, it's just simply...

window.w1.close();

johnadam
11-18-2003, 09:30 AM
I have implemented the changes and what a difference!

The tenth window now opens as quickly as the first and all the window management is working

Thanks for the speedy help.