Questions tagged [js-cookie]

A simple, lightweight JavaScript API for handling cookies (previously called jquery-cookie)

A simple, lightweight JavaScript API for handling cookies (previously )

Feature Overview

  • Crossbrowser
  • Doesn't rely on any framework
  • Supports ES modules
  • Supports AMD/CommonJS
  • RFC 6265 compliant

Documentation & Links

130 questions
0
votes
0 answers

Cookie seems not to work

Since i needed to have some variables of my programs available in all the pages, i decided to use cookies (js-cookie). if ((Cookies.get('j') == null) || (Cookies.get('j') == 0)) { Cookies.set('j', 0); var j = parseInt(Cookies.get('j')); } …
Francesco Monti
  • 151
  • 2
  • 10
0
votes
2 answers

js-cookie always get undefined when Cookies.get

I'm using js-cookie plugin, I'm setting a cookie and when I try to read it I get always undefined. I began doing Cookies.set('cookie', { "something": { "key1": value1, "key2":…
Alex
  • 1,230
  • 2
  • 24
  • 46
0
votes
0 answers

javascript understanding cookies indepth

In my frontend react application, I am trying to check if a session cookie exists, as this will help me decide whether to show a login page (if no session cookie exists or invalidated), or show content page. The backend express-session middleware…
0
votes
1 answer

How can I complete a JS action based on the presence of a cookie?

I am working on a form and when you focus on an input field, I have a pop up that reminds them to save when they are complete. I only want the user to see this pop up once every 60 days. On focus I set a cookie that tells me they have seen the…
0
votes
1 answer

Why there are several duplicated entries when I set the cookie?

I use the library js-cookie. Previously, I used jquery.cookie. I have some issue with duplicating cookie entries. Some time, when i call Cookies.set('my-cookie-name', 'value', {'path': '/'}); I am sure that I call this method only one place in my…
0
votes
1 answer

Js if is not work in setInterval()

Hello! I have This in my website: var docCookies = { getItem: function (sKey) { if (!sKey) { return null; } return decodeURIComponent(document.cookie.replace(new RegExp("(?:(?:^|.*;)\\s*" + encodeURIComponent(sKey).replace(/[\-\.\+\*]/g,…
Radi Cho
  • 680
  • 7
  • 21
0
votes
1 answer

Jquery cookie function not finding null value

I have a button that when clicked should delete a cookie, call a function that collects a value from a textbox and save it as the new cookie value. The problem I'm having is that after the button is clicked, the function is executing as if there was…
exeleon
  • 121
  • 2
  • 14
-1
votes
2 answers

how can i test my script to delete cookies

I wrote a script in javascript to delete all cookies (except some included in a whitelist) within the current domain (using document.cookie). How can I make sure that it is working and indeed deleting the cookies? I ran it in the browser by…
ma p
  • 11
  • 3
-1
votes
1 answer

Uncaught TypeError: Cannot read property 'cookie'

So, I've got a page where i set a cookie with js-cookie script and following code. js.cookie-2.1 is loaded right before that script. Cookies.set('dir', '1'); No JS errors there. When i try to get the cookie value on a different page, it looks like…
Arlindo
  • 13
  • 5
-5
votes
2 answers

Javascript - Can I display the value of a cookie in HTML?

I have a bootstrap website and I stock user information in cookies with the plugin JS-cookie. Can I show the value of the cookie in the HTML with classic JS/Jquery or do I have to use a framework like Angular ? EDIT : I use js-cookie …
Samuel-Zacharie Faure
  • 1,047
  • 11
  • 26
1 2 3
8
9