Obtain cookies of the page being visited

依然范特西╮ 提交于 2020-01-06 02:34:38

问题


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.


回答1:


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


来源:https://stackoverflow.com/questions/6232443/obtain-cookies-of-the-page-being-visited

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!