Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

opened window problem

Status
Not open for further replies.

phatbyte

Programmer
Oct 28, 2003
11
AT
hello folks!

i have a mainwindow that has an eventhandler onLoad="window.open()" .. now.. if i refresh this site the newly opened window refreshes.. but it shouldn't do that.. any solution? he should open the window once.. if it is opened leave it..

thanks in advance
oliver
 
Check if this works for you.....

<HTML>
<HEAD>

<SCRIPT LANGUAGE=&quot;JavaScript&quot;><!--
function openWindow() {
if (!window.window2) {
// has not yet been defined
window2 = window.open('apage.html','windowRef','width=100,height=100');
}
else {
// has been defined
if (!window2.closed) {
// still open
window2.focus();
}
else {
window2 = window.open('apage.html','windowRef','width=100,height=100');
}
}
}

openWindow()
//--></SCRIPT>

</HEAD>

<FRAMESET COLS=&quot;100%,*&quot;>
<FRAME SRC=&quot;apage.html&quot;>
<FRAME SRC=&quot;bpage.html&quot;>
</FRAMESET>

</HTML>


HTH

 
hm doesn't work.. in the newly opened window is a flash application with sound on startup.. and so the sound always start new on a main page refresh..
 
<script language=&quot;JavaScript&quot;><!--
function openWindow() {
if (!window.window2) {
// has not yet been defined
window2 = window.open('/<dtml-var expr=&quot;getSiteObj().absolute_url(relative=1)&quot;>/jukebox_index_html','windowRef','width=100,height=100');
}
else {
// has been defined
if (!window2.closed) {
// still open
window2.focus();
}
else {
window2 = window.open('/<dtml-var expr=&quot;getSiteObj().absolute_url(relative=1)&quot;>/jukebox_index_html','windowRef','width=100,height=100');
}
}
}

openWindow()
--></script>
 
sajuks, ur method wont work as whenever the page is refreshed variable window2 will be set to null therefore the new window will open. i dont think there is a way to overcome that problem (other than cookies)...

Known is handfull, Unknown is worldfull
 
Hi vbkris,
It should work if am using a frameset, its a workaround.
True this wont work if am not using a frameset as mentioned in the url which i've posted.
I checked it out.
Regards
 
even if its a frameset it wont work as the refresh button (in ur IE toolbar) will refresh the entire frame, only a right click will refresh the selected frame...

Known is handfull, Unknown is worldfull
 
is it possible to do a onUnload event in the new opened window so that he don't reload it?
 
like i said the only option is to use cookies, create a cookie when the window is opened, check if the cookie is active, if yes open the new window, else dont open it, in the popup window in its onunload event destroy the cookie...

Known is handfull, Unknown is worldfull
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top