包含文件的 HTTP 标头 VS 浏览位置!

发布于 2024-09-11 16:25:14 字数 114 浏览 0 评论 0原文

当浏览器因为 url 包含在另一个页面中而发送 http 标头时,它与通过浏览该页面调用它时有什么不同吗?例如,如果我有 myjavascript.php,我是否能够判断它是否被浏览它的人查看,而不是包含在标签中?

When an http header is sent by a browser because the url is included in another page is it any different than when it is called by browsing to that page. for example if I have myjavascript.php am I gonna be able to tell if its being viewed by someone browsing to it rather than it being included in a tag?

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

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

发布评论

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

评论(1

胡渣熟男 2024-09-18 16:25:14

当人们想知道如何检测图像盗取时,这种情况经常出现。

浏览器通常会为页内请求发送一个“Referer”(原文如此)标头,其中包含包含链接的页面的 URL。

这可以使用 $_SERVER['HTTP_REFERER'] 变量访问(注意不常见的拼写)。

这个想法是,您可以检查此变量并查看它是否引用您网站的一部分。

请注意,该变量并不总是准确的;用户可以选择通过不发送引用标头(使用某种小型隐私工具)来保护他们的隐私,他们甚至可以修改他们的浏览器以发送他们想要在此字段中发送的任何内容。因此,不应依赖它进行身份验证,除非您还考虑到即使是合法用户也可能将其留空或在其中放入任意字符串。

This comes up a lot when people want to know how they can detect image leeching.

The browser will usually send a "Referer" (sic) header for in-page requests which contain the URL of the page that containing the link.

This is accessible using the $_SERVER['HTTP_REFERER'] variable (note unusual spelling).

The idea is that you can check this variable and see if it refers to part of your site.

Note that this variable is not always accurate; a user may elect to protect their privacy by not sending a referer header (using some sort of dinky privacy tool) and they may even modify their browser to send whatever they want in this field. So it shouldn't be relied upon for authentication, unless you also take into account that even a legitimate user may have left it blank or put an arbitrary string in it.

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