如何防止Fancybox IFrame中断?

时间:2017-04-10 15:11:39

标签: javascript jquery html iframe fancybox

我发现下面的方法会导致IFrame爆发。

<script type="text/javascript">
if(top.location != window.location) {
    window.location = 'www.IFrameDetected.com';
}
</script>

经过一些研究后我确定如果我使用常规IFrame而不是fancybox IFrame,那么可以应用sandbox="allow-forms allow-popups allow-pointer-lock allow-same-origin allow-scripts"而不包含allow-top-navigation的沙盒选项来规避上述内容提到突破方法。

但我还没有找到一种方法来使用这种方法与Fancybox iframe,或找到一种专门用于Fancybox IFrames的方法。我目前的fancybox的一个例子如下。

$.fancybox.open({
    src: example.com,
    type: 'iframe',
    opts: {}
})

0 个答案:

没有答案
相关问题