简体   繁体   English

如何在网站上观看 cookies 以了解它们是如何设置的?

[英]How can I watch cookies on a website to see how they're set?

First, should this be on anther StackExchange site?首先,这应该在另一个 StackExchange 站点上吗?

I'm trying to scrape a site and it appears to set a cookie in Javascript: when looking at the HTTP requests all of a sudden the cookie appears as a request cookie without a preceding response command to set it.我正在尝试抓取一个站点,它似乎在 Javascript 中设置了一个 cookie:当查看 HTTP 请求时,突然 cookie 显示为请求 cookie,而没有前面的响应命令来设置它。 Is there any way in any major browser (ideally on OS X but I can boot into Windows or Linux) to watch a site's cookies and pause loading or execution of a page when there's a change and highlight the Javascript code or HTTP response that is responsible? Is there any way in any major browser (ideally on OS X but I can boot into Windows or Linux) to watch a site's cookies and pause loading or execution of a page when there's a change and highlight the Javascript code or HTTP response that is responsible ?

Cookies are not asked for, they are given, therefore you wont see it being requested. Cookies 没有被要求,它们是给定的,因此你不会看到它被要求。

They will come down in the headers and there is no way to determine, what, who or where they came from (apart from knowing they came from the site you are browsing or possibly sites it is linked to).它们将出现在标题中,并且无法确定它们来自什么、来自谁或来自哪里(除了知道它们来自您正在浏览的站点或可能链接到的站点之外)。

Open up Webkit Inspector and look at the network/resources tabs.打开 Webkit Inspector 并查看网络/资源选项卡。 Filter by "documents".按“文档”过滤。 Go through each documents' response headers and see if there is a cookie set. Go 通过每个文档的响应头,查看是否有 cookie 集。 If not, then it must be JavaScript in which case you can do a search for "document.cookie".如果不是,那么它必须是 JavaScript 在这种情况下,您可以搜索“document.cookie”。

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

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