【发布时间】:2017-04-17 16:16:36
【问题描述】:
我想禁用 iframe 嵌入页面,从我的网站到其他网站 我做这个js:
<script type="text/javascript">
if(document.referrer.indexOf("mydomain.com") != -1) {
window.location = "http://www.youtube.com/watch_popup?v=oHg5SJYRHA0";
}
</script>
脚本有效,但我有 page01.php 和 page02.php
我想在 page01.php 源代码中为 page02.php 插入 iframe
<iframe src="page02.php"></iframe>
当我这样做时,我被重定向到:
http://www.youtube.com/watch_popup?v=oHg5SJYRHA0
如何解决这个问题? 谢谢
【问题讨论】:
-
更改
window.location = "<destination_url>"中的目标字符串?无论如何我都会在服务器端编写代码
标签: javascript iframe referer