Organizational Research By

Surprising Reserch Topic

how to prevent iframe from redirecting top level window


how to prevent iframe from redirecting top level window  using -'javascript,html,iframe'

Some websites have code to "break out" of IFRAME enclosures, meaning that if a page A is loaded as an IFRAME inside an parent page P some Javascript in A redirects the outer window to A.

Typically this Javascript looks something like this:

<script type="text/javascript">
  if (top.location.href != self.location.href)
     top.location.href = self.location.href;
</script>


My question is: As the author of the parent page P and not being the author of the inner page A, how can I prevent A from doing this break-out?

P.S. It seems to me like it ought to be a cross-site security violation, but it isn't.
    

asked Sep 16, 2015 by yogeshplv
0 votes
19 views



Related Hot Questions

8 Answers

0 votes
NULL
answered Sep 16, 2015 by abhi
0 votes
NULL
answered Sep 16, 2015 by sameer rathore
0 votes
NULL
answered Sep 16, 2015 by sachin valanju
0 votes
NULL
answered Sep 16, 2015 by girisha
0 votes
NULL
answered Sep 16, 2015 by kotmus2002
0 votes
NULL
answered Sep 16, 2015 by mtabakade
0 votes
NULL
answered Sep 16, 2015 by akhilesh
0 votes
NULL
answered Sep 16, 2015 by nimisha.jagtap

...