I wonder, is there a way to override the iframe's window.top and window.parent such that from it's context the following is true
window === window.parent && window === window.top
The case is that the app that I want to embed in an iframe has many references to window.top, it stores objects and uses them to communicate back and forth with its own child iframes.
<iframe sandbox=""></iframe>
Without "allow-scripts" is not an option for me as any access to window.top throws and Error, while I want things to work pretty much as if the iframe was a top level window
Note: I saw a similar question asked How to Trick/Fool an Iframe to thinking its the TOP element in DOM but there while the same requirement, the actual problem - changing the top.location could be worked-around, this is why I guess the discussion was discontinued.
The simple answer is no you can not change a read-only property.
The more complex answer is that you could parse the other site through a proxy server and dynamically rewrite the JS. However I strongly expect that is more effort than it is worth and will likely break copyright laws at some point.
The question you should be asking is does the third-party want to be in your iFrame? If yes get them to fix their code, if no then you shouldn't be doing this.