禁止和允许被iframe

1.防止被iframe
if (window != window.top)
{ window.top.location = location; }

2.允许被信任的网站iframe
var framebustTimer;
var timeout = 3000; // 3 second framebust timeout

if (window != window.top)
{
framebustTimer = setTimeout(
function() { window.top.location = location; }, timeout);
}

你可能感兴趣的:(iframe)