google chrome extension - How to read cookies from localhost? -
I am trying to develop a Chrome extension, and the first step is to determine that the user logs on to my website. Yes or No. For development, if I am testing against localhost
, how do I read a cookie?
In my manifest, it is:
"permissions": ["cookies", "tab", "http: // * / *", "https: / / * / * "],
and JavaScript:
chrome.cookies.get ({" url ": 'localhost'," name " : '_ga'}, function (cookie) {console.log ('cookie:'); console log (cookie);});
But I get this error:
unchecked runtime. Error while running unknown cookies. Invalid url: "localhost"
Can anyone tell me in the right direction?
localhost
is not a valid URL; This is just an [alleged] host name.
Use http: // localhost
with the protocol for the URL.
Comments
Post a Comment