Need to break out of iframe after content in iframe is submitted

后端 未结 3 470
长发绾君心
长发绾君心 2020-12-07 01:10

Ok, I am using an iframe on a page. The content within the iframe I have no control over and is being utilized with an Adobe Flash program.

But once the form is sum

3条回答
  •  难免孤独
    2020-12-07 01:57

    Chris Coyier at css-tricks.com has a nice succinct explanation of how to do this.

    One way is a little clearer to the observer (as much as production Javascript code can ever said to be "clear"):

    (function(window) {
      if (window.location !== window.top.location) {
        window.top.location = window.location;
      }
    })(this);
    

    The other is much shorter, but also trickier and less obvious:

    this.top.location !== this.location && (this.top.location = this.location);
    

    Again, credit where credit is due: I didn't write these snippets, I'm just passing them along because they answer the question.

提交回复
热议问题