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.