JSON.stringify() saving in cookies but error 403

I am trying to save or set this below value in $.cookie() // jQuery as I set and reloaded the page, but the error showed error 403.

again when I delete the cookies, the page opens rightly.

"[{\"name\":\"john\",\"age\":\"32\",\"website\":\"profile/user\"}]"

How did I set it properly and without error?

Your json string looks correct. So it should be possible to store it in a cookie. Also storing in a cookie should not cause an error at all. So there must be something in your code which is wrong but you need to show it to us.

Btw. The string is much more readable if you put it in single quotes

Are you trying to use this cookie for authentication? 403 means the server denied access to the remote resource.

in cookies, it shows like this
"%5B%7B%22name%22%3A%22john%22%2C%22age%22%3A%2232%22%2C%22website%22%3A%22profile%2Fuser%22%7D%5D"

I think this error comes from my “serviceworker.js” file pastebin

(event.request.method === "GET" && event.request.headers.get("accept").includes("text/html"))

Please help How I fix this…

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.