Link to home
Start Free TrialLog in
Avatar of Jennie2004
Jennie2004

asked on

How do I break out from an IFRAME?

I have a normal HTML-page.
In that page I have the following
****************************************
<head>
<script language="JavaScript">
<!--
ns4 = (document.layers)? true:false
ie4 = (document.all)? true:false
function load(page) {
      if (ns4) document.textLayer.src = page
      else if (ie4) parent.textFrame.document.location = page
}
//-->
</SCRIPT>
<STYLE>
#textDiv {position:absolute; left:180; top:100; width:400; height;200; clip:rect(0,400,200,0);}
</STYLE>
</head>

<body>
<DIV ID="textDiv">
<IFRAME SRC="test0.html" NAME="textFrame" SCROLLING="No" WIDTH="420" HEIGHT="500" MARGINWIDTH=0 MARGINHEIGHT=0 FRAMEBORDER="No"></IFRAME>
</DIV>

<DIV id="Layer1" style="position:absolute; left:5px; top:100px; width:150px; height:160px; z-index:1">
<A HREF="javascript:parent.load('newpage.html')">
Newpage</A>
</div>
</body>
*****************************************************
When I click on the link Newpage I display the newpage.html in the IFRAME.
THE PROBLEM:
When I am inside the IFRAME and click on a link I want a whole new window to open BUT the new link opens INSIDE the IFRAME.
I am stuck inside that IFRAME. How do I get out from it?
I tried with target=new but no success...

Can you help me?

 link to
Avatar of sajuks
sajuks

in newpage.htnl place this between the head tags
<script language="Javascript">
<!--
if (top.location!= self.location) {
top.location = self.location.href
}
//-->
</script>
In the head of the newpage.html you need this:
<html>
<head>
<base target="_top">
</head>
<body>...

ASKER CERTIFIED SOLUTION
Avatar of Zvonko
Zvonko
Flag of North Macedonia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Jennie2004

ASKER

The change I experience from both of your gentlemens' solution are similar.
Sajuks, with your script I the newpage.html opens ITSELF in a completely new window.
I want the newpage.html to stay in the IFRAME but when I click on a link INSIDE IFRAME I want the next page to open in a completely new and fresh window. I wasn't to clear in my question. I apologize.

<base target="_blank"> works when I click on a link in newpage.html

Therefor I thank both of you but have to give the points to Zvonko. No hard feelings Sajuks I hope...
But I have "hard" feelings :-)
Why did I got a grading B???
The point system is quit new to me so maybe you are right and should have had an even higher grade. I thought that maybe I would be to generous if I sent a higher grade. The use of superlatives are generally overused in the everyday. I think it was a good solution. I will think more carefully in the future and will remember that I "owe" you one ;)
Ok, I can explain it to you ;-)
I do this stuff for free, so how would you pay my work to me except to say "Thank You".
Therefore you are not a Teacher telling me how good or bad my support was, but simply say Excelent! :)

But it is still not loast. You can correct your grading by posting a request for grading correction in this topic area:
https://www.experts-exchange.com/Community_Support/

Thanks in advance,
Zvonko

Hi!
I could only find this when I was looking to change grade. Reading it I clearly can see that it was a A-grade answer you provided me with. You were right about the teacher metahphor.
I will continue to look for where I can ask the question to change the grade...

A: The Expert(s) either provided you with a thorough answer or they provided you with a link to information that thoroughly answered your question. An "A" can also be given to any answer that you found informative or enlightening beyond the direct question that you asked.

B: The Expert(s) provided an acceptable solution, or a link to an acceptable solution, that you were able to use, although you may have needed a bit more information to complete the task.

C: Because Experts' reliability are often judged by their grading records, many Experts would like the opportunity to clarify if you have questions about their solutions. If you have given the Expert(s) ample time to respond to your clarification posts and you have responded to each of their posts providing requested information; or if the answers, after clarification, lack finality or do not completely address the issue presented, then a "C" grade is an option. You also have the option here of just asking Community Support to delete the question.
Remember, the Expert helping you today is probably
Click on the folowing link and you are there:
https://www.experts-exchange.com/Community_Support/askQuestion.jsp
Alright!
It is done! My apologies for the f*ck up. You will get the Excellent grade that you deserve. I can now also return to this topic to read the grade system. Thank you for letting me know :)
Not a problem at all.
It is only a part of the game ;-)