473,322 Members | 1,379 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,322 software developers and data experts.

How to refresh a parent frame from a pop up?

I am working on updating a Web site with a frameset. A page opens a
pop-up window in which the user uploads pictures. Once the upload is
done, I would like to refresh the content of the frame which opened the
pop-up but so far have failed. Here is my code:

<%

(ASP code which saves the photo in a database)

%>
<HTML>
<head>
<script language="javascript">
var url = top.parent.window.opener.document.all.MYURL.innerH TML +
'?ADID=<%=pintADID%>&MODE=S1&VIEWMODE=2';
top.parent.window.opener.location.href = url;
top.parent.window.close();
</script>
</head>
<body></body>
</html>
What I am trying to do is simply refresh the parent window with the
same URL. The ?ADID=<%=pintADID%>&MODE=S1&VIEWMODE=2' portion is there
to ensure that the browser does not refresh without the parameters.

Thanks a lot for your help!

Jul 23 '05 #1
3 10574
ni****@yahoo.com wrote:
I am working on updating a Web site with a frameset. A page opens a
pop-up window in which the user uploads pictures. Once the upload is
done, I would like to refresh the content of the frame which opened the
pop-up but so far have failed. Here is my code: .... var url = top.parent.window.opener.document.all.MYURL.innerH TML +
'?ADID=<%=pintADID%>&MODE=S1&VIEWMODE=2';
top.parent.window.opener.location.href = url;
top.parent.window.close(); ....
Does the popup have a frameset?
If not, you could do this:

var url = (
opener.document.getElementById ?
opener.document.getElementById( 'MYURL' )
: opener.document.all.MYURL
).innerHTML + '?ADID=<%=pintADID%>&MODE=S1&VIEWMODE=2';

// if the location is already the url, just reload
if( opener.location.href == url )
opener.location.reload();

// otherwise, nagivate to said url
else
opener.location.href = url;

window.close();
</script>
</head>
<body></body>
</html>
What I am trying to do is simply refresh the parent window with the
same URL. The ?ADID=<%=pintADID%>&MODE=S1&VIEWMODE=2' portion is there
to ensure that the browser does not refresh without the parameters.


See above.

The code above is missing some compatibility checks for brevity's sake.

Also, in some circumstances it is a bad a idea to print the URL into
the page without first doing some translation of it. I don't know how
you're putting the URL in the page itself (i.e. whether you're building
the URL from scratch, doing any translation, or just dumping it into
the output), but be aware of any possible security considerations, as
this will allow users to essentially edit the code of the page that is
displayed and cause the browser to interpret the code in the context of
your domain name.

You may also want to check that the parent window is still relevant to
the popup, prior to trying to work with it.

Jul 23 '05 #2
Thanks. I am only taking over some sloppy development done prior to me. The
job is to get something to work, without reprogramming everything. The
client already spent a fortune for a Web site which does not function
properly.

I am not the best Javascript programmer out there, because I never really
spent a lot of time learning the compatibility issues.

Is this code MSIE-only? What would also work with Mozilla/Firefox and
Safari?

Thanks a lot for your help!

"Random" <ra*******@gmail.com> wrote in message
news:11**********************@g43g2000cwa.googlegr oups.com...
ni****@yahoo.com wrote:
I am working on updating a Web site with a frameset. A page opens a
pop-up window in which the user uploads pictures. Once the upload is
done, I would like to refresh the content of the frame which opened the
pop-up but so far have failed. Here is my code:

...
var url = top.parent.window.opener.document.all.MYURL.innerH TML +
'?ADID=<%=pintADID%>&MODE=S1&VIEWMODE=2';
top.parent.window.opener.location.href = url;
top.parent.window.close();

...
Does the popup have a frameset?
If not, you could do this:

var url = (
opener.document.getElementById ?
opener.document.getElementById( 'MYURL' )
: opener.document.all.MYURL
).innerHTML + '?ADID=<%=pintADID%>&MODE=S1&VIEWMODE=2';

// if the location is already the url, just reload
if( opener.location.href == url )
opener.location.reload();

// otherwise, nagivate to said url
else
opener.location.href = url;

window.close();
</script>
</head>
<body></body>
</html>
What I am trying to do is simply refresh the parent window with the
same URL. The ?ADID=<%=pintADID%>&MODE=S1&VIEWMODE=2' portion is there
to ensure that the browser does not refresh without the parameters.


See above.

The code above is missing some compatibility checks for brevity's sake.

Also, in some circumstances it is a bad a idea to print the URL into
the page without first doing some translation of it. I don't know how
you're putting the URL in the page itself (i.e. whether you're building
the URL from scratch, doing any translation, or just dumping it into
the output), but be aware of any possible security considerations, as
this will allow users to essentially edit the code of the page that is
displayed and cause the browser to interpret the code in the context of
your domain name.

You may also want to check that the parent window is still relevant to
the popup, prior to trying to work with it.

Jul 23 '05 #3
So far as I know it should work in most relatively modern browsers.
Expect compatibility issues with older versions of Netscape that few
people still use, and probably other older, less-used agents.

Nicolas Verhaeghe wrote:
Thanks. I am only taking over some sloppy development done prior to me. The
job is to get something to work, without reprogramming everything. The
client already spent a fortune for a Web site which does not function
properly.

I am not the best Javascript programmer out there, because I never really
spent a lot of time learning the compatibility issues.

Is this code MSIE-only? What would also work with Mozilla/Firefox and
Safari?

Thanks a lot for your help!

"Random" <ra*******@gmail.com> wrote in message
news:11**********************@g43g2000cwa.googlegr oups.com...
ni****@yahoo.com wrote:
I am working on updating a Web site with a frameset. A page opens a
pop-up window in which the user uploads pictures. Once the upload is
done, I would like to refresh the content of the frame which opened the
pop-up but so far have failed. Here is my code:

...
var url = top.parent.window.opener.document.all.MYURL.innerH TML +
'?ADID=<%=pintADID%>&MODE=S1&VIEWMODE=2';
top.parent.window.opener.location.href = url;
top.parent.window.close();

...
Does the popup have a frameset?
If not, you could do this:

var url = (
opener.document.getElementById ?
opener.document.getElementById( 'MYURL' )
: opener.document.all.MYURL
).innerHTML + '?ADID=<%=pintADID%>&MODE=S1&VIEWMODE=2';

// if the location is already the url, just reload
if( opener.location.href == url )
opener.location.reload();

// otherwise, nagivate to said url
else
opener.location.href = url;

window.close();
</script>
</head>
<body></body>
</html>
What I am trying to do is simply refresh the parent window with the
same URL. The ?ADID=<%=pintADID%>&MODE=S1&VIEWMODE=2' portion is there
to ensure that the browser does not refresh without the parameters.


See above.

The code above is missing some compatibility checks for brevity's sake.


Jul 23 '05 #4

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

Similar topics

1
by: Adrian | last post by:
Hi, I Need help. This is my situation right now. I have a page which contain 2 frame. On the 1st frame which contain a header and a drop down box and the 2nd frame contains information. I would like...
1
by: tony wong | last post by:
the page has upper frame (submit record) and lower frame (show records). i wish to refresh lower frame once submit record at upper frame. i try this, it works to refresh the lower frame...
1
by: Helixpoint | last post by:
I have a frameset. left and main. Inside the main frame I have a IFRAME. I need to refresh the main frame when I post a form inside the IFRAME. I am trying the code below with no luck?? ...
2
by: Jeronimo Bertran | last post by:
Hi, I have a page with a very data intensive grid which needs to be automatically refreshed constantly if a change is detected. In order to not refresh the complete page so often, I created an...
8
by: Judy Ward | last post by:
I have an index.aspx with frames. The top frame has a navigation bar with a "Login" hyperlink. If the user has already logged in I want this link to change to "Logout". I am using forms-based...
3
by: Kevin | last post by:
Hi guys, I want to refresh some pages every 2 seconds. however, these html pages are not in my site, they could be any pages from yahoo.com or msn.com. I can create a page, which redirect to...
1
by: monkeys paw | last post by:
I have a web page with four frames in it. If, within one of the frames, i use a javascript function to do something like: window.location = "app.cgi" Only the frame that contains the JS will...
10
by: markwalker84 | last post by:
Hello everyone! Got a bit of a problem... Two of the panels on my program contain a number of check boxes. The exact number of which is determined by a pair of variables. I have recently...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
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...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.