views:

708

answers:

2

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.

A: 

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.

Jawa
A: 

There is an SO question by Jeff Atwood that addresses this (but kind of in reverse): http://stackoverflow.com/questions/958997/frame-buster-buster-buster-code-needed

DanSingerman