i use javascript to judge a page is in a iframe:
if (this != top) {
alert("true");
}
enter image description here
but i get "true" all the time,even if not in a iframe(as up picture),who can help me?
asked Apr 3, 2012 at 15:16
artwl
3,5927 gold badges41 silver badges55 bronze badges
-
2An old question of possible interest.Pointy– Pointy2012年04月03日 15:19:36 +00:00Commented Apr 3, 2012 at 15:19
-
1Or possibly this.Surreal Dreams– Surreal Dreams2012年04月03日 15:20:48 +00:00Commented Apr 3, 2012 at 15:20
1 Answer 1
Try
if (self != top) {
alert("true");
}
answered Apr 3, 2012 at 15:20
Dennis
14.5k3 gold badges51 silver badges58 bronze badges
Sign up to request clarification or add additional context in comments.
Comments
lang-js