获取正在访问的页面的Cookie [英] Obtain cookies of the page being visited
本文介绍了获取正在访问的页面的Cookie的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想知道如何使用内容脚本和背景页面之间的通信链接获取当前页面的Cookie。这是一个扩展。
解决方案
您可以使用内容脚本访问您访问的每个网站的 document.cookie
。然后,您可以使用消息传递将Cookie从您的内容脚本传递到您的后台页面。
<例如:Stack Overflow有很多例子:
- Chrome扩展:如何捕获选定的文本并发送到Web服务
- Chrome扩展程序:如何将内容脚本中的变量传递给background.html
- 谷歌浏览器扩展程序 - 体系结构问题
- Chrome扩展程序:存取内容脚本中的localStorage
- 在background.html中,如何访问当前网页以获取dom
- 使用Chrome扩展消息传递
I want to know how can we obtain the cookies of the current page being accessed using a communication link between the content script and background page. This is for an extension.
解决方案
You can use Content Scripts to access document.cookie
for each website you visit. Then you can use Message Passing to pass the cookies from your Content Script to your Background Page.
There are many examples on Stack Overflow for example:
- Chrome Extension: how to capture selected text and send to a web service
- Chrome Extension: How to pass a variable from Content Script to background.html
- Google Chrome Extension - Architecture Question
- Chrome extension: accessing localStorage in content script
- In background.html,how can I access current web page to get dom
- Help with chrome extension message passing
这篇关于获取正在访问的页面的Cookie的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文