0

我在 iframe 中显示一个页面,在我的 Node.js 服务器中,我需要访问主页的 URL。

我不想在 iframe 中获取页面的请求 URL,但我需要浏览器地址栏中的 URL,即主页的 URL。

4

2 回答 2

1

Referer请求标头应包含您要查找的 URL 。

http://www.nczonline.net/blog/2013/04/16/getting-the-url-of-an-iframes-parent/

iframe 内页面的 HTTP Referer 标头始终设置为包含页面的 URL。

于 2013-09-04T15:13:36.970 回答
0

尝试此页面http://nodejs.org/api/url.html中的 Url 模块 ctrl-f 'pathname'

于 2013-09-04T16:09:38.993 回答