如果页面为iframe,则重定向
redirect if the page is iframe
以下是我想要做的:
在我的博客中,评论显示在使用iframe的fancybox弹出窗口中。(例如:-对于第2个帖子,评论链接打开iframe粉丝盒comments.php?id=2
)
我想检查comments.php是否加载在iframe中,如果没有,则重定向到相应的博客页面。即post.php?id=2
我查看了谷歌和其他网站,包括stackoverflow。但没有用。请帮忙。(这看起来很容易,但不起作用http://www.onlineaspect.com/2009/06/10/reading-get-variables-with-javascript/
将此脚本放入页面中。如果它没有在一个帧中打开,它将重定向到post.php?id=...
<script type="text/javascript">
if (parent.location==location) {
location.href = "post.php" + location.search;
}
</script>
我在想类似的东西
if ( document.parent.frames.length > 0 ) {
document.parent.location = "post.php";
}
应该工作
相关文章:
- 重定向iFrame中的父URL
- 如果页面为iframe,则重定向
- 附加'沙箱'属性设置为动态创建的iframe以停止重定向
- Iframe提交并将用户重定向回原始页面,但Iframe似乎仍然存在
- 在不使用 JavaScript 的情况下通过 iframe 访问时从页面重定向
- 由 URL 触发的来自 iFrame 的 JavaScript 重定向
- 读取iframe重定向(同一域)
- 在iFrame内部保持重定向
- js重定向,如果不在fb iframe中
- 停止重定向嵌入的iframe
- 移动设备上的 iFrame 重定向主页问题
- 根据文本框中的值范围重定向到 iframe 中的 URL
- 从外部 iFrame 重定向和链接中删除历史记录
- 刷新 iframe 而不重定向父页面
- 使用 javascript 从 MVC Action 通过 iFrame 重定向到父级
- 使用 Javascript/jQuery 重定向时将 POST 数据发送到顶级 iframe
- 使用目标从弹出窗口在 safari 中发布和重定向 iframe
- 窗口位置 阻止 iframe 重定向父窗口
- 表单提交后重定向iframe
- 如何重定向Iframe到另一个URL php