We help IT Professionals succeed at work.

meta refresh to top

arichee
arichee asked
on
How would I code a meta refresh to the top of another page?  It doesn't appear that the meta tag allows a target option.  Is there a way in javascript?
Comment
Watch Question

Commented:
do you mean top frame or just to go to another page and start from the top?  If you are looking to simply go to another page and start from the top you do not need a target because it should always start at the top.  If you want to go to another page and start from a specific spot then you need two things.  First lable the target:


<a name="here">

then on the page you want to refresh from you would use the meta refresh with the # before indicating the targeted spot:

<meta http-equiv="refresh" content="2;URL=http://www.domain.com/test2.htm#here">

If it's for frames then I don't know.
Top Expert 2005

Commented:
You could use Javascript like this:

To refresh a specific window:
windowName.location.reload();

Refresh this window:
location.reload();

If "this" page is a part of a frame, you refresh the frame like this:

top.location.reload();

To reload an other frame than the one we're in :

top.frames[0].location.reload();

Top Expert 2005

Commented:
Or if you want to wait:

setTimeout("windowName.reload()",2000);

This waits 2 seconds before reloading the window named "windowName".

Author

Commented:
The HREF is within a child within a frameset, and I want to meta refresh to entirely new frameset.
try this:

<script language="JavaScript">
<!--
parent.location = 'http://www.yourdomain.com/yourpage.html';
//-->
</script>

i hope that helps...

Explore More ContentExplore courses, solutions, and other research materials related to this topic.