473,837 Members | 1,429 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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="javas cript">
var url = top.parent.wind ow.opener.docum ent.all.MYURL.i nnerHTML +
'?ADID=<%=pintA DID%>&MODE=S1&V IEWMODE=2';
top.parent.wind ow.opener.locat ion.href = url;
top.parent.wind ow.close();
</script>
</head>
<body></body>
</html>
What I am trying to do is simply refresh the parent window with the
same URL. The ?ADID=<%=pintAD ID%>&MODE=S1&VI EWMODE=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 10608
ni****@yahoo.co m 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.wind ow.opener.docum ent.all.MYURL.i nnerHTML +
'?ADID=<%=pintA DID%>&MODE=S1&V IEWMODE=2';
top.parent.wind ow.opener.locat ion.href = url;
top.parent.wind ow.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=<%=pintA DID%>&MODE=S1&V IEWMODE=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=<%=pintAD ID%>&MODE=S1&VI EWMODE=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*******@gmai l.com> wrote in message
news:11******** **************@ g43g2000cwa.goo glegroups.com.. .
ni****@yahoo.co m 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.wind ow.opener.docum ent.all.MYURL.i nnerHTML +
'?ADID=<%=pintA DID%>&MODE=S1&V IEWMODE=2';
top.parent.wind ow.opener.locat ion.href = url;
top.parent.wind ow.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=<%=pintA DID%>&MODE=S1&V IEWMODE=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=<%=pintAD ID%>&MODE=S1&VI EWMODE=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*******@gmai l.com> wrote in message
news:11******** **************@ g43g2000cwa.goo glegroups.com.. .
ni****@yahoo.co m 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.wind ow.opener.docum ent.all.MYURL.i nnerHTML +
'?ADID=<%=pintA DID%>&MODE=S1&V IEWMODE=2';
top.parent.wind ow.opener.locat ion.href = url;
top.parent.wind ow.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=<%=pintA DID%>&MODE=S1&V IEWMODE=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=<%=pintAD ID%>&MODE=S1&VI EWMODE=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
1686
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 to know how to refresh a whole page from a click of a button which will then refresh a new value base on Session ID??
1
5974
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 function ABC() { window.parent.mainFrame.location.reload();} <input type="button" value="refresh" onclick="return ABC()"></TD>
1
4732
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?? Private Sub addMachine_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles addMachine.Click Dim sScript As New System.Text.StringBuilder sScript.Append("<SCRIPT language=""javascript"">" & vbCrLf)
2
23529
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 iframe on my page whose html has the refresh meta as follows : <meta http-equiv="refresh" content="10"> The iframe is effectivelyh refreshed every 10 seconds without having the
8
2871
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 authentication and think I know how to accomplish this part. My problem is that the top frame does not reload to get to the "If User.Identity.IsAuthenticated Then". Please don't tell me I shouldn't be using frames; this is a school assignment and the...
3
2123
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 public internet html page, but how can I do this in a loop? do I need to write a console application to make it work? thanks
1
7289
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 refresh. I need to refresh all four frames from within one. How do I do that??
10
35969
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 implemented a Wizard which changes that number, as well as a save and load function to the program. I know the number of being altered in memory (i added a quick check button) but what i'm struggling with is how to refresh the panel with the new...
0
9843
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
9682
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,...
0
10875
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10566
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10623
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
10272
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...
0
9401
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7806
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...
3
3124
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.