Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to reload a page with anchors ?

Status
Not open for further replies.

Chaotik

Programmer
Aug 28, 2000
3
CA
I am using this Javascript to reload a page that has anchors:
<SCRIPT language=&quot;javascript&quot;>
opener.reload();
opener.location=&quot;commande-form.cfm#candidat&quot;;
self.close();
</SCRIPT>

what happens is that the opener doesn't reload, I do make it to the candidat anchor (but again the page isn't reloaded so it's no good) and the self window doesn't close.

However, using this :
<SCRIPT language=&quot;javascript&quot;>
opener.location=&quot;commande-form.cfm&quot;;
self.close();
</SCRIPT>

the opener page does reload and the self window closes..
how can I merge the 2 so that the opener reloads, I jump to my anchor and the self window closes ???

any help appreciated.

Thanks

Matt

 
matt,
can you explain what you're trying to do? seems to me that the reload() really doesn't do much, since the next line in the script replaces the content that was just reloaded.
 
Well..
if I only put this line :

opener.location=&quot;commande-form.cfm#candidat&quot;;

I do get to my anchor but the page isn't reloaded..
I just tought that by throwing that in :
opener.reload();

it would refresh it before going to the anchor point.

Mathieu
 
Oh, I see, this is a dynamic page, and you need to present more current content? In that case, you need to make sure that your content gets retrieved from the server, rather than the cache. Make sure that caching is disabled.
 
it is a dynamic page.
Caching is disabled.
it is very weird..
my guess is that we can't do this :
opener.location=&quot;commande-form.cfm#candidat&quot;;
in javascript..

the #candidat doesn't look like it's going through well..
with the # the page doesn't refresh
without, it does but the page doesn't scroll down to the proper position.
There's mabe an alternative way to do the same thing ?
 
Matt, Did you try this?

<SCRIPT language=&quot;javascript&quot;>
opener.location=&quot;commande-form.cfm&quot;;
opener.location=&quot;commande-form.cfm#candidat&quot;;
self.close();
</SCRIPT>

HTH,
Thierry
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top