从 iFrame 检索完整的 URL
可能的重复:
如何获取 iframe 的当前位置?< /a>
嗨,我想获得完整的 URL,通过我知道的方法,我获得了 iframe 的完整 url,并且我想要“最终”document.location.href,
我怎样才能获得它?
我不在乎它是 php 还是 js,但通过我的实验我猜测 PHP 是不可能的......
Possible Duplicate:
How do I get the current location of an iframe?
Hi i want to get the complete URL, and with the methods i know i get the full url but of the iframe, and i want the 'final' document.location.href,
how can i get it?
i don't care if its php or js, but i'm guessing by my experiments that with PHp it's not possible...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您想知道您当前所在位置:
alert(window.location)
。.$_SERVER["REQUEST_URI"]
或$_SERVER['PATH_INFO']
取决于您想要的。If you want to know where you currently are:
alert(window.location)
..$_SERVER["REQUEST_URI"]
or$_SERVER['PATH_INFO']
depending on what you want.看看这个问题的最佳答案。
请务必注意,如果
iframe
的 URL 与父页面来自不同的域,则(幸运的是!)不可能获取iframe
的 URL。如果你想这样做,你可能会不走运。Take a look at the top answer from this question.
It's important to note that it's (luckily!) not possible to get the URL of an
iframe
if theiframe
's URL is from a different domain than the parent page. If you're trying to do that, you're probably out of luck.