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="javascript:void(0);"
onclick=\'win1=window.open("http://127.0.0.1/comments.php?site_name=<?php
echo $site_name;?>&linker='+linker[argument]+'", "devWindow",
"height=450,width=420,screenX=0,left=50,screenY=0, top=100,location=0,menubar=0,scrollbars=1,status=0 ,toolbar=0",
"option2") ;win1.focus(); \' target="">'+href+'</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="cleanup()">
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. 3 4550
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="javascript:void(0);" onclick=\'win1=window.open("http://127.0.0.1/comments.php?site_name=<?php echo $site_name;?>&linker='+linker[argument]+'", "devWindow", "height=450,width=420,screenX=0,left=50,screenY=0, top=100,location=0,menubar=0,scrollbars=1,status=0 ,toolbar=0", "option2") ;win1.focus(); \' target="">'+href+'</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="javascript:...") 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="someWindow"
onclick="window.open('page.html','someWindow');ret urn 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="cleanup()">
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.******@blueyonder.co.invalid (replace ".invalid" with ".uk" to reply)
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.location.reload(); -- Mozilla Bug
var originalLocation = window.opener.location;
window.opener.location.href = originalLocation;
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="javascript:void(0);" onclick=\'win1=window.open("http://127.0.0.1/comments.php?site_name=<?php echo $site_name;?>&linker='+linker[argument]+'", "devWindow", "height=450,width=420,screenX=0,left=50,screenY=0, top=100,location=0,menubar=0,scrollbars=1,status=0 ,toolbar=0",
"option2") ;win1.focus(); \' target="">'+href+'</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="javascript:...") 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="someWindow" onclick="window.open('page.html','someWindow');ret urn 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="cleanup()">
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
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.location.reload(); -- Mozilla Bug
There is AFAIS no Mozilla bug (any more).
var originalLocation = window.opener.location; window.opener.location.href = originalLocation;
No need for the variable.
window.close(); } [Top post]
Please do not do that.
PointedEars This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
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...
|
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...
|
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(). ...
|
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
|
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...
|
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...
|
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...
|
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 ...
|
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 ...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
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...
|
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
|
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...
|
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...
| |