Join the AMA (Ask Me Anything) with the Firefox leadership team to celebrate Firefox 20th anniversary and discuss Firefox’s future on Mozilla Connect. Mark your calendar on Thursday, November 14, 18:00 - 20:00 UTC!

Ce site disposera de fonctionnalités limitées pendant que nous effectuons des opérations de maintenance en vue de vous proposer un meilleur service. Si un article ne règle pas votre problème et que vous souhaitez poser une question, notre communauté d’assistance est prête à vous répondre via @FirefoxSupport sur Twitter, et /r/firefox sur Reddit.

Rechercher dans l’assistance

Évitez les escroqueries à l’assistance. Nous ne vous demanderons jamais d’appeler ou d’envoyer un SMS à un numéro de téléphone ou de partager des informations personnelles. Veuillez signaler toute activité suspecte en utilisant l’option « Signaler un abus ».

En savoir plus

Can not get cookie after set by using document.cookie on firefox 57

  • 6 réponses
  • 1 a ce problème
  • 25 vues
  • Dernière réponse par Tam Vo

more options

Hi, I'm writing a web extension and when I opened extension debugging mode through "about debugging".

From console tab, I type "document.cookie = "username=tam;expires=Mon, 23 Feb 2018 17:35:38 GMT;path=/";" and Enter to set cookie. But after set, I type "document.cookie" it return empty string.

And my extension can not set or get cookie from document.cookie

I don't know what happen with cookie that I set.

Hi, I'm writing a web extension and when I opened extension debugging mode through "about debugging". From console tab, I type "document.cookie = "username=tam;expires=Mon, 23 Feb 2018 17:35:38 GMT;path=/";" and Enter to set cookie. But after set, I type "document.cookie" it return empty string. And my extension can not set or get cookie from document.cookie I don't know what happen with cookie that I set.
Captures d’écran jointes

Modifié le par Tam Vo

Toutes les réponses (6)

more options

Post your question in the add-ons forum; https://discourse.mozilla-community.org/c/add-ons

more options

I posted on discourse.mozilla.org and hope someone will answer it. Thanks.

more options

Does it work if you leave a space after the colons?

  • document.cookie = "username=tam; expires=Mon, 23 Feb 2018 17:35:38 GMT; path=/";
more options

It's still not working.

more options

I see the username=tam cookie in the Storage Inspector and also in document.cookie.

Make sure you do not run Firefox in permanent Private Browsing mode (Always use Private Browsing mode; Never Remember History) in case that makes a difference.

  • Options/Preferences -> Privacy & Security -> Firefox will: "Use custom settings for history"
  • remove checkmark: [ ] "Always use Private Browsing mode"

Start Firefox in Safe Mode to check if one of the extensions ("3-bar" menu button or Tools -> Add-ons -> Extensions) or if hardware acceleration is causing the problem.

  • switch to the DEFAULT theme: "3-bar" menu button or Tools -> Add-ons -> Appearance
  • do NOT click the "Refresh Firefox" button on the Safe Mode start window
more options

I setup with your suggestion. In developer tools for web extension, I can not get cookie after set. On developer tool on web I can set and get it. See attachment below.