使用 PHP 从工具栏上的书签获取当前页面 URL

发布于 2024-10-06 18:52:16 字数 320 浏览 0 评论 0原文

我正在寻找在网址栏中获取当前页面的网址

[工具栏中的书签按钮] - 用户在 YouTube 链接上按下它 并将其发送到 sitename.com/test.php

书签中的 url 然后打印类似

sitename.com/test.php?url=http://www.youtbe.com/whateverwatever

我尝试使用引用者 bur 的内容,因为它来自书签链接,因此无法工作 我也尝试了 Javascript 中的引荐来源网址,但它仍然不起作用

I am looking to get the url of current page in url bar

[BookMark Button In Tool Bar] - User Presses it while on a youtube link
and sends it to sitename.com/test.php

The url in the bookmark then prints something like

sitename.com/test.php?url=http://www.youtbe.com/whateverwatever

I tried using referrer bur since it's coming from a bookmark link it won't work
I also tried the referrer in Javascript but it still won't work

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

小嗷兮 2024-10-13 18:52:16

我相信您只想要window.location.href。这将获得当前位置,然后你可以用它做你想做的事情。

I believe you just want window.location.href. That'll get the current location then you can do what you want with it.

您的好友蓝忘机已上羡 2024-10-13 18:52:16

您无法执行此操作,因为如果您单击书签,则不会有引荐来源网址。

如果您想制作“共享此”书签之类的东西,您可以使用一些 JavaScript 来制作“小书签”。 Delicious 有一个一个小书签可以做这种事情。

You can't do this, as there isn't a referrer if you click a bookmark.

If you're trying to make a "share this" bookmark sort of thing, you can use some JavaScript to make a "bookmarklet". Delicious has a bookmarklet that does this sort of thing.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文