IE Overwrite window.top

前端 未结 4 1477
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-15 05:17

I\'m trying to convince a page that it is the window.top even though it is in an iframe.

In FF you can do

window.defineGetter(\'top\', fu

相关标签:
4条回答
  • 2021-01-15 05:57

    I'd maybe try using the "define getter" notation that John Resig uses in his article on the topic:

    Window.prototype.__defineGetter__('top',function(){return this;});

    0 讨论(0)
  • 2021-01-15 06:06

    Use this:

    Object.defineProperty(window, "parent", { 
            get: function() {return window;} 
        }
    );
    

    More info here.

    0 讨论(0)
  • 2021-01-15 06:11

    Setting window.top doesn't work. Its not allowed in IE.

    I ended up having to make my own fake window object, fill it with most of the properties of the window object, and then making a fake .top property.

    0 讨论(0)
  • 2021-01-15 06:17

    Try window.top = window.top.window

    More details on DOM Window.

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