简体   繁体   中英

Chrome extension. Can't save cookie on facebook.com, but works on other sites

I am currently working on a chrome extension which will count the time I spend on specyfic websites. In order to do that I use cookies so I could remember elapsed time when I close chrome.

The problem is that I can save my cookies on every websites I tried, but it doesn't work on a facebook. When I inspect cookies on facebook it says that my cookie expires at Thursday, 1 January 1970 at 00:59:58 and cookie content is "deleted". Although I specified expiration date in my code and it works properly on other websites.

Setting cookie in my code looks like this:

 let cookie = {
    'name': 'myCookie',
    'url': 'https://' + websiteName,
    'value': timeSum.toString(),
    'expirationDate':cookieExp
};


chrome.cookies.set(cookie);

Anyone has an idea where is the problem?

好的,所以我不确定它是否真的有用,但是我恢复了chrome设置,现在我的cookie设置了一段时间并具有适当的值,此后它又消失了,值被“删除”了。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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