?
Solved

remove frame and iframe??

Posted on 2003-11-15
7
Medium Priority
?
523 Views
Last Modified: 2012-06-27
using javascript can anyone please help to make the page come out of IFRAME.
i have the code to come out of the Frame but not from IFRame.

can you please help.

code below helps to come out of frame but not iframe
<SCRIPT LANGUAGE="JavaScript">
<!--
setTimeout ("changePage()", 3000);
function changePage() {
if (self.parent.frames.length != 0)
self.parent.location="default.aspx";
}
// -->
</SCRIPT>
0
Comment
Question by:swech
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 15

Assisted Solution

by:JakobA
JakobA earned 240 total points
ID: 9757601
<SCRIPT LANGUAGE="JavaScript">
<!--
setTimeout ("changePage()", 3000);
function changePage() {
    if ( top != self ) {   // should work for frames and iframes both.
        top.location="default.aspx";
    }
}
// -->
</script>

regards JakobA
0
 
LVL 25

Expert Comment

by:devic
ID: 9757604
<script>
if (top.location != self.location)
{
      top.location = self.location.href
}
</script>
0
 
LVL 11

Accepted Solution

by:
Zontar earned 200 total points
ID: 9757758
if(top != self)
  top.location.href = self.location.href;

location is an *object*; its href property is the URL string. Setting location doesn't work in some browsers -- set location.href instead.
0
Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

 
LVL 15

Expert Comment

by:JakobA
ID: 9757781
>> swech
  Zontar is right. I should have made that correction.
0
 
LVL 10

Expert Comment

by:NetGroove
ID: 9757959
Here my proposal:

<SCRIPT LANGUAGE="JavaScript">
<!--
setTimeout ("changePage()", 3000);
function changePage() {
  if (top.frames.length != 0)
     top.location="default.aspx";
}
// -->
</SCRIPT>

The reason for my variant is that parent can be written when not same domain, but can not be read for the compare.

Good luck,
NetGroove

0
 

Assisted Solution

by:anstp
anstp earned 400 total points
ID: 9760322
here's how i would do it similar to zontar
<script>
if (top.location != self.location)
{
self.location.url="default.aspx"    
top.location = self.location.url
}
</script>
0
 

Author Comment

by:swech
ID: 9760875
Thanks for the  answer.
sorry zontor could not accept you answer coz i'm totally new to javascript so had to do some research on how to redirect to default.aspx. But thanks to anstp for the correct answer.
jokoba's code also worked .

working fine now.,

0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
This article discusses how to create an extensible mechanism for linked drop downs.
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)
The viewer will learn the basics of jQuery including how to code hide show and toggles. 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…
Suggested Courses

770 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