How to Stop Gmail from maximizing an iFrame?

扶醉桌前 提交于 2019-12-13 16:24:24

问题


I am trying to create a webpage with Gmail embedded in an iframe. However, Gmail has some javascript code that executes whenever it is loaded. I believe the following js code snippet is what causes Gmail to hijack the window and maximize itself, destroying my parent iframe:

if (top.location != self.location) {
  top.location = self.location.href;
}

Preferably, I am looking for a solution that works cross-browser (and does not involve greasemonkey, or some other browser-based hack). If jquery has some applicable function/plugin, that would be great.


回答1:


As the code Gmail uses is located in a block it's hard to prevent it from running. There might be some useful insights in an article about preventing frame-busting.




回答2:


There is an SO question by Jeff Atwood that addresses this (but kind of in reverse): Frame Buster Buster ... buster code needed



来源:https://stackoverflow.com/questions/2181439/how-to-stop-gmail-from-maximizing-an-iframe

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!