繁体   English   中英

防止Javascript重定向

[英]Prevent Javascript from redirecting

我正在将PHP与CURL一起使用,以在页面中包含其他网站的一部分。 现在,包含的部分包含了一些JavaScript代码,它们可以将页面重定向到./framebuster。 404会导致该页面不在我的服务器上。

有没有一种方法可以运行JavaScript代码来防止其进入./framebuster? 不一起禁用JavaScript?

是否已加载到iframe中?

您可以尝试使用sandbox="allow-same-origin"破坏对Javascript的控制,如下所示:

<iframe id="iframeOtherSite" src="http://www.othersite.com/" sandbox="allow-same-origin"/>

尝试将onbeforeunload属性与window.frames[0].stop()以阻止iframe加载有问题的脚本!

如果您想了解更多关于onbeforeunload 请参见此处

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM