Link to home
Start Free TrialLog in
Avatar of swech
swech

asked on

remove frame and iframe??

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>
SOLUTION
Avatar of JakobA
JakobA

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 devic
<script>
if (top.location != self.location)
{
      top.location = self.location.href
}
</script>
ASKER CERTIFIED SOLUTION
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 JakobA
JakobA

>> swech
  Zontar is right. I should have made that correction.
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

SOLUTION
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 swech

ASKER

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.,