By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,747 Members | 1,594 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,747 IT Pros & Developers. It's quick & easy.

How to stop child frame script from overwriting parent page?

P: 2
Hi,
I have a web page where I have a iframe with src pointing to external web sites. Some external websites have scripts which overwrites my parent page. Is there any way to either disable that kind of scripts in child frame or is there any way to protect parent page from that kind of overwriting?

Thanks
Oct 26 '07 #1
Share this Question
Share on Google+
3 Replies


gits
Expert Mod 5K+
P: 5,390
hi ...

welcome to TSDN ...

could you please give an example for that?

kind regards
Oct 27 '07 #2

P: 2
One example script in external web sites which overwrites my page is:
if (window.self != window.top) {
top.location.replace(window.location.href);
}

So how do I protect my page against these scripts...
Oct 28 '07 #3

acoder
Expert Mod 15k+
P: 16,027
Is there any way to either disable that kind of scripts in child frame or is there any way to protect parent page from that kind of overwriting?
Disabling is not possible because the child frame is from another domain. The frame-busting script is there for a reason. They don't want you to put their site in a frame. Leaving aside the ethical argument, I'm not sure if it is possible to prevent this anyway (though I may be wrong).
Oct 29 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.