changing iframe url changes parent window url

前端 未结 2 989
萌比男神i
萌比男神i 2021-01-26 20:43

i\'m using following page to display content of a url in a iframe and changing it based on input value .





        
相关标签:
2条回答
  • 2021-01-26 21:10

    From www.coolmath.com:

    if (window.self != window.top) ...
    

    meaning the site activly escapes being framed.

    0 讨论(0)
  • 2021-01-26 21:13

    You may notice that even something like this <iframe src='http://www.coolmath-games.com/0-fraction-splat/index.html'></iframe> results in the same. This is a technique called frame-busting. It's in their page's code:

    <script>
    <!-- Hide Script
     if (top.location != self.location) {
       top.location = self.location
     }
    //End Hide Script-->
    </script>
    

    If you have a server, that can respond with a HTTP/1.1 204 No Content header, you may be able to "deactivate" this frame buster as described here.

    0 讨论(0)
提交回复
热议问题