473,763 Members | 6,666 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How hard can it be to reload the main window ?!?!!?

Hi all,

I'm trying to reload a frame from a pop-up, but really cannot figure
this out.

Within my index.htm file, I make a link to call a pop-up frame with a
javascript function that calls the following code from an external
javascript source file, dynamically created with PHP

document.write( '<a href="javascrip t:void(0);"
onclick=\'win1= window.open("ht tp://127.0.0.1/comments.php?si te_name=<?php
echo $site_name;?>&l inker='+linker[argument]+'", "devWindow" ,
"height=450,wid th=420,screenX= 0,left=50,scree nY=0,top=100,lo cation=0,menuba r=0,scrollbars= 1,status=0,tool bar=0",
"option2") ;win1.focus(); \' target="">'+hre f+'</a>');

Within the pop-up window, I use the following code
----> Head section

<script type="text/javascript">
cleanup () {
opener.location = opener.location .href;
opener.location .reload();
}
</script>
</head>

<body class="body" marginheight="0 " marginwidth="0"
onUnload="clean up()">

I want the file index.php to reload when the pop-up is closed down. I
seem to have tried every variation of opener.reload() , but still can't
manage it solve it.

Can anyone see what I am doing wrong ?

I'm starting to pull my hair out.....
Rgds
Neil.
Jul 20 '05 #1
3 4580
On 17 Feb 2004 05:55:03 -0800, sentinel <ne**@sentinel. f9.co.uk> wrote:
Within my index.htm file, I make a link to call a pop-up frame with a
javascript function that calls the following code from an external
javascript source file, dynamically created with PHP

document.write( '<a href="javascrip t:void(0);"
onclick=\'win1= window.open("ht tp://127.0.0.1/comments.php?si te_name=<?php
echo $site_name;?>&l inker='+linker[argument]+'", "devWindow" ,
"height=450,wid th=420,screenX= 0,left=50,scree nY=0,top=100,lo cation=0,menuba r=0,scrollbars= 1,status=0,tool bar=0",
"option2") ;win1.focus(); \' target="">'+hre f+'</a>');
I'm not going to check too hard if that's syntactically correct. You
should only post client-side code, replacing server-side code with what
might be generated. Formatting your posts with indentation and controlled
line-breaks (rather than newsreader wrapping) would also be helpful.
However, I will say this:

Don't use the JavaScript pseudo-protocol (href="javascri pt:...") unless
there is a good reason to. In this case, it isn't much of a problem as
non-JavaScript users won't even see that link, but for other cases, one
should consider alternative approaches, such as,

- Buttons
- <a href="" onclick="<code> ;return false;"
- <a href="page.html " target="someWin dow"
onclick="window .open('page.htm l','someWindow' );return false"
<script type="text/javascript">
cleanup () {
Syntax error. Should be:

function cleanup() {
opener.location = opener.location .href;
opener.location .reload();
}
</script>
</head>

<body class="body" marginheight="0 " marginwidth="0"
onUnload="clean up()">

I want the file index.php to reload when the pop-up is closed down. I
seem to have tried every variation of opener.reload() , but still can't
manage it solve it.


Other than that syntax error, the problem could be that the onunload event
isn't firing. Onunload is unreliable, at best. I know for a fact that
Opera only fires it when the page is changed. Closing the tab, window, or
refreshing the page does nothing. Mozilla fires it when the page is
changed or refreshed, but not when closed. Netscape and IE fire it when
the page is changed, refreshed or closed. That's only four browsers, all
of which displaying different behaviours, amongst a hundred.

If this refreshing is critical, it might be worth integrating the pop-up
window into the main page, then using a link to go to another page.

Mike

--
Michael Winter
M.******@blueyo nder.co.invalid (replace ".invalid" with ".uk" to reply)
Jul 20 '05 #2
KD
This worked for me:

function cleanup()
{
// This is done in the following way because Mozilla does not
// want to obey the simpler .reload() function.
// window.opener.l ocation.reload( ); -- Mozilla Bug

var originalLocatio n = window.opener.l ocation;
window.opener.l ocation.href = originalLocatio n;
window.close();
}

Michael Winter wrote:
On 17 Feb 2004 05:55:03 -0800, sentinel <ne**@sentinel. f9.co.uk> wrote:
Within my index.htm file, I make a link to call a pop-up frame with a
javascript function that calls the following code from an external
javascript source file, dynamically created with PHP

document.write( '<a href="javascrip t:void(0);"
onclick=\'win1= window.open("ht tp://127.0.0.1/comments.php?si te_name=<?php
echo $site_name;?>&l inker='+linker[argument]+'", "devWindow" ,
"height=450,wid th=420,screenX= 0,left=50,scree nY=0,top=100,lo cation=0,menuba r=0,scrollbars= 1,status=0,tool bar=0",

"option2") ;win1.focus(); \' target="">'+hre f+'</a>');

I'm not going to check too hard if that's syntactically correct. You
should only post client-side code, replacing server-side code with what
might be generated. Formatting your posts with indentation and
controlled line-breaks (rather than newsreader wrapping) would also be
helpful. However, I will say this:

Don't use the JavaScript pseudo-protocol (href="javascri pt:...") unless
there is a good reason to. In this case, it isn't much of a problem as
non-JavaScript users won't even see that link, but for other cases, one
should consider alternative approaches, such as,

- Buttons
- <a href="" onclick="<code> ;return false;"
- <a href="page.html " target="someWin dow"
onclick="window .open('page.htm l','someWindow' );return false"
<script type="text/javascript">
cleanup () {

Syntax error. Should be:

function cleanup() {
opener.location = opener.location .href;
opener.location .reload();
}
</script>
</head>

<body class="body" marginheight="0 " marginwidth="0"
onUnload="clean up()">

I want the file index.php to reload when the pop-up is closed down. I
seem to have tried every variation of opener.reload() , but still can't
manage it solve it.

Other than that syntax error, the problem could be that the onunload
event isn't firing. Onunload is unreliable, at best. I know for a fact
that Opera only fires it when the page is changed. Closing the tab,
window, or refreshing the page does nothing. Mozilla fires it when the
page is changed or refreshed, but not when closed. Netscape and IE fire
it when the page is changed, refreshed or closed. That's only four
browsers, all of which displaying different behaviours, amongst a hundred.

If this refreshing is critical, it might be worth integrating the pop-up
window into the main page, then using a link to go to another page.

Mike

Jul 20 '05 #3
KD wrote:
This worked for me:

function cleanup()
{
// This is done in the following way because Mozilla does not
// want to obey the simpler .reload() function.
// window.opener.l ocation.reload( ); -- Mozilla Bug
There is AFAIS no Mozilla bug (any more).
var originalLocatio n = window.opener.l ocation;
window.opener.l ocation.href = originalLocatio n;
No need for the variable.
window.close();
}

[Top post]


Please do not do that.
PointedEars
Jul 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2081
by: Marshall Dudley | last post by:
I need to be able to allow a user to submit a form which opens another window. This part I have working. But after the submit, I need to delay and have the original window do a reload. I cannot figure out how to do this. If I do a delay and reload with an OnSubmit, then the new window will load only after the reload, which will not work. Basically the first page displays a set of things that need to be done, and after clicking on the...
1
1148
by: Christian Perthen | last post by:
Hi, How can I trigger a reload in another window. Basically, I have a main page with link to a pop-up window. When closing the pop-up window I would like to have the main page reloaded (populated with some session variables selected from the pop-up window). Any ideas? Thanks in advance
19
31068
by: Darren | last post by:
I have a page that opens a popup window and within the window, some databse info is submitted and the window closes. It then refreshes the original window using window.opener.location.reload(). The problem is that after the reload, it brings you right to the top of the page. When I click 'refresh" on the original page, it brings me back to the original viewing position. Is there a way to duplicate this in from the popup window. Also,...
1
1080
by: Grey | last post by:
I have one main window and one dialog window. Is it possible to reload the content of main window which is triggered from one button on dialog window. Million Thanks
2
7009
by: Sonnich | last post by:
Hi all! Probably simple - once one knows. I have a window, which open using <input type="button" class="box" name="main" value=" Add... " onClick=window.open('add.asp')> The window has some funtionality, then I have this, which still needs
7
24544
by: Raffi | last post by:
I'm facing a tricky (at least for me) page reload/refresh scenario and need some help. I'm working on a web application which is primarily used with MSIE. The application has a main window with an i-frame in it. The i-frame contains various dynamic links for opening data entry popups. One of these popups has a couple of i-frames itself. These i-frames also have links to scripts which make changes to a server side database. I need for...
1
1746
by: Emil Horowitz | last post by:
Hi, I knew this before, but seem to have forgotten all about it: How do I make the main window reload once, after I close the popupup window launched from the main window? Putting "onFocus=location.reload()" into the body tag gerenates an endless loop right after loading the page. Any help? Thank you, Emil
3
2144
by: pipet2002 | last post by:
i have created a main page which contains a frame on the center . the frame has a link which opens a new separate window. i am trying to create a function that will make it possible for me to click a button to close the new separate window and then reload the frame window.reload not seem to work cause i cant specify the page to reload
1
2202
by: pipet2002 | last post by:
i have created a main page which contains a frame on the center . the frame has a link which opens a new separate window. i am trying to create a function that will make it possible for me to click a button to close the new separate window and then reload the frame window.reload not seem to work cause i cant specify the page to reload
0
9564
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9387
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
9938
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9823
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7368
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5270
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5406
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3917
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2794
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.