简体   繁体   English

Rails:request.referrer == request.url

[英]Rails: request.referrer == request.url

Perhaps I misunderstand how request.referrer works, but isn't it suppose to provide you with the url of the page the user is coming from? 也许我误会了request.referrer工作原理,但不是应该为您提供用户所来自页面的网址吗? So for instance, if they're viewing an article and then click edit, their request might look like this: 因此,例如,如果他们正在查看文章,然后单击“编辑”,则他们的请求可能如下所示:

request.referrer = http://localhost:3000/article/1
request.url = http://localhost:3000/article/1/edit

If that's the case, then I'm getting odd behaviour, because the user's request.referrer is always set to the current url. 如果真是这样,那我就变得有些奇怪,因为用户的request.referrer始终设置为当前URL。 What might be causing this? 是什么原因造成的? It's worth noting that I'm using an AJAX powered site, and all these requests are remote. 值得注意的是,我正在使用AJAX驱动的站点,并且所有这些请求都是远程的。

request.referrer应该是您发出请求的URL,如果您使用的是AJAX,我认为您应该更改URL,以便您的引荐来源更改。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM