我想阻止其他网站将我的网站内容IFraming到他们的网站上,但同时我想允许少数网站这样做。有人能帮忙吗?
请记住,由于http://en.wikipedia.org/wiki/Same_origin_policy
,您在iframe中受到限制将在break out keep in代码中编辑。
if (window=window.top) {
}else {
top.location.href = 'http://YourDomain.com';
}
保留在画布页面的iframe示例中。我用它来保持我的页面在facebook上的画布。
if (window!=window.top) {
}else {
top.location.href = 'https://apps.facebook.com/AnotherFeed/?ref=redirect#comments';
}
可能的工作围绕研究。http://en.wikipedia.org/wiki/Cross-document_messaging
来自https://www.facebook.com/groups/fbdevelopers/284446968265491/的问题由我参考堆栈