【发布时间】:2013-01-06 23:54:43
【问题描述】:
我正在尝试在 iFrame 中打开一些以弹出窗口形式打开的网站。 有些网站不允许自己在 iFrame 中打开(Frame Busting)。
我已经搜索过了。我也有一些解决方案,比如
$(window).bind('beforeunload', function (event) {
return 'Custom message.';
});
beforeunload 对我不起作用,因为即使在我的网站内导航时它也会运行
我也试过了
// Event handler to catch execution of the busting script.
window.onbeforeunload = function () { prevent_bust++ };
// Continuously monitor whether busting script has fired.
setInterval(function () {
if (prevent_bust > 0) { // Yes: it has fired.
prevent_bust -= 2; // Avoid further action.
// Get a 'No Content' status which keeps us on the same page.
window.top.location.href = 'http://mysiteurl/#';
}
}, 1);
上面也不起作用,它会重定向到正在 iFrame 中打开的 url。
那么有什么解决方案可以在 IFrame 中打开网站(具有 Frame Buster)。
问候, 萨加尔·乔希
【问题讨论】:
标签: iframe popup framebusting