Using Meta HTTP-EQUIV=Refresh with frames and target="_top"

Posted on 2006-10-20
Last Modified: 2008-01-09
I'm stuck on something that may well be easy.  I am using a refresh tag like the one below within a frame:


I would like to be able to have this refresh automatically go to the top level and thereby eliminate all of the frames.  I can do this within a form statement or via a URL using target="_top" as in the example below:

<a href="HTTP://" target="_top"> </i>Finished</a>

I can't seem to figure out how to properly format the target="top" within the Meta tag to work.  Is there a way to do this or some straight forward HTML equivalent?  If standard HTML can't do it, are there other simple options?


Question by:Mike93110
  • 4
  • 3
LVL 54

Accepted Solution

b0lsc0tt earned 500 total points
ID: 17775320

The META tag does not take a target.  However it sounds like you are entering this meta tag in the html for one of the frames instead of the html of the page that sets up the frames.  Put the META tag in page that sets up the frames.

If you can't do that then you can try to use the body tag and javascript below.

<body onload="top.document.location='';">

Let me know if neither option will work.  Let me know if you have any questions or need more information.


Author Comment

ID: 17775401
Hi b0lsc0tt,

Thanks.  A quick test shows that the body tag may work for us.  I'll test it out more thoroughly this morning and if the implementation solves our issue, I'll get accept your response within the next few hours.

Thanks again for the quick response and straight forward solution.

LVL 54

Expert Comment

ID: 17775412
Your welcome!  Let me know if there is an issue or if you need more info and how the test works out.

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center


Author Comment

ID: 17776370

That did give us the solution for which I was looking.  Let me know if you'd like me to ask either of the following as new questions.

1) We have two frames.  One has a form statement with input fields.  When the uses enters information into the input frame we'd like the second window to refresh itself.  Is there a simple way to do this by adding some code to the first window with the input field without reloading all the frames including the top frame?  If the body tag onload is the simplest option and assuming that the second window's name was Win2 what would I need to change the top.document.location to (e.g.,  Win2.document.location)?

2) Also if the Win2 frame had a scroll bar and the user had scrolled  halfway down the frame, is it possible to easily refresh their page and return them to the same scroll point.  If that is possible wthout too much programming but it would be more appropriate to ask to ask that as new question, just let me know that it is possble and I'd be happy to ask it as a new question.

Thanks again,

LVL 54

Expert Comment

ID: 17777060
Your welcome!  I'm glad the test did what you wanted.

1. Are you submitting the form?  If so the quick answer is to make the second window the target.  That will cause it to be refreshed when the form is submitted.  Depending on the situation it may not work for what you have on the pages but it is the easiest way.  The form tag below is an example of how you could do it (notice the target attribute).

  <form method="post" action="filename.asp" target="frameWindowName">

2. Most browsers will return to the same portion of the page if the user clicks or initiates the refresh.  However to do it in programming you would need some way to know where they are and to put them back.  Named anchors (e.g. <a name="part2"></a>) in your html is one way to "name" sections.  A url can go to that specific section using #name (e.g. <a href="page.htm#part2">Go to part2</a>).  In Javascript you can use focus to go to a specific form field but I don't know if that would work in this case.  Is there something to "focus" on and how would you know what it is?

Both of these deserve their own new questions.  My reply to one may be enough so you don't need a question for it but the second one is more involved and we would need more details.  Even clever programming may not be able to do the second one.  Feel free to post a follow up here if you have some question about this comment.  I will keep an eye open for the new questions if you post them or you could post the URL here (if with in the next few days) to notify me.  I hope this helps!

Author Comment

ID: 17777208
Thanks for the help.  I'll try one and if that doesn't work I'll post a new question for it.  It sounds like two may be a bit trickier.
LVL 54

Expert Comment

ID: 17777231
> It sounds like two may be a bit trickier
Yeah, but not necessarily impossible.  It just depends on the specifics.  It can be very easy under the right circumstances.

I'm gald that I could help you.  Thank you for the grade, the points and the fun question.


Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is a PowerShell web interface I use to manage some task as a network administrator. Clicking an action button on the left frame will display a form in the middle frame to input some data in textboxes, process this data in PowerShell and display…
This article discusses four methods for overlaying images in a container on a web page
In this Micro Tutorial viewers will learn how to create navigation buttons that change on rollover, using CSS (Continuation of the CSS Image Sprite tutorial) Create a parent ID for all the list items       - Specify position: absolute and display: block…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

860 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question