window.top.location.hostname的问题!高手进。速度结贴!

YSEE 2008-04-11 05:10:54
站点A (http://www.a.com/a.aspx) 站点B(http://www.b.com/b.aspx)

站点A页面iframe 里调入站点B页面,在站点B页面里怎么得到站点A的访问路径?(http://www.a.com/a.aspx)
在B页面里放入window.top.location.hostname 提示location.hostname有问题!

怎么解决
...全文
538 12 打赏 收藏 转发到动态 举报
写回复
用AI写文章
12 条回复
切换为时间正序
请发表友善的回复…
发表回复
YSEE 2008-04-12
  • 打赏
  • 举报
回复
document.domain 这个能设置吗?
怎么设置呀?
rjzou2006 2008-04-12
  • 打赏
  • 举报
回复
是存在权限问题

哪用后台取吧。
YSEE 2008-04-12
  • 打赏
  • 举报
回复
有办法解决吗?
或者其他办法获取父iframe的URL
shouzheng 2008-04-12
  • 打赏
  • 举报
回复
跨域访问了,这弄不来的
「已注销」 2008-04-12
  • 打赏
  • 举报
回复
不可以。

如果允许你这么干,那浏览器可就太不安全了。

你的需求,恰好是钓鱼网站的基本原理。

@_@
YSEE 2008-04-11
  • 打赏
  • 举报
回复
但提示的是没有权限
YSEE 2008-04-11
  • 打赏
  • 举报
回复
alert("a");alert(window.parent.location.href);

前面的a弹出 后面的就错了
hookee 2008-04-11
  • 打赏
  • 举报
回复
跨域访问,没有权限
YSEE 2008-04-11
  • 打赏
  • 举报
回复
有错!~:
{alert(parent.location.href);
文盲老顾 2008-04-11
  • 打赏
  • 举报
回复
b

<script>
alert(parent.location.href);
</script>
YSEE 2008-04-11
  • 打赏
  • 举报
回复
window.parent.location.

??
文盲老顾 2008-04-11
  • 打赏
  • 举报
回复
iframe?

parent.location.href

87,907

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧