Solved

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

Posted on 2006-10-20
7
3,377 Views
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:

<META HTTP-EQUIV="Refresh" CONTENT="60; URL=HTTP://www.mysite.com">

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://www.mysite.com" 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?

Thanks,

Mike
0
Comment
Question by:Mike93110
  • 4
  • 3
7 Comments
 
LVL 54

Accepted Solution

by:
b0lsc0tt earned 500 total points
ID: 17775320
Mike93110,

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='http://www.mysite.com';">

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

b0lsc0tt
0
 

Author Comment

by:Mike93110
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.

Mike
0
 
LVL 54

Expert Comment

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

bol
0
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 

Author Comment

by:Mike93110
ID: 17776370
bol,

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,

Mike
0
 
LVL 54

Expert Comment

by:b0lsc0tt
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!
0
 

Author Comment

by:Mike93110
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.
0
 
LVL 54

Expert Comment

by:b0lsc0tt
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.

bol
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
This article discusses how to create an extensible mechanism for linked drop downs.
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…

743 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now