Linked Questions

220 votes
4 answers
408k views

Why this does not work ? if(typeof(localStorage.getItem("username"))=='undefined'){ alert('no'); }; The goal is to redirect the user from the index page to the login page if not already logged. ...
Gabriel's user avatar
  • 2,481
1 vote
1 answer
8k views

Possible Duplicate: HTML5 localStorage: check if item isset I am developing an Sencha Touch 2 App using the localStorage. I get values from the local storage like this: var localStore = Ext....
Nico's user avatar
  • 1,081
2 votes
1 answer
481 views

Working on a Chrome Extension that allows users to keep a list that uses localStorage. Working so far: user can input things in their list and it will store in localStorage, user can delete things ...
H Roark's user avatar
  • 75
-1 votes
1 answer
320 views

I want to limit the number of clicks on a button per day to 5 clicks using cookies. So when a user clicks 5 times, the button will no longer be clickable. I managed to do that, but the problem is when ...
CODE GENUIS's user avatar
0 votes
5 answers
237 views

I am testing to see if a localstorage key exists or not. So first I've done a console.log to see what's inside the value... console.log(localStorage.getItem('mykey')); This returns null So I've ...
user avatar
-1 votes
1 answer
138 views

I have a localStorage value, which I am getting const marks = JSON.parse(localstorage.getItem('mark')) Now I am trying to make it robust so that if there is no key with mark in localStorage then it ...
ganesh kaspate's user avatar
3104 votes
24 answers
1.5m views

I'd like to store a JavaScript object in HTML5 localStorage, but my object is apparently being converted to a string. I can store and retrieve primitive JavaScript types and arrays using localStorage, ...
Kristopher Johnson's user avatar
3 votes
3 answers
2k views

I have been searching about this many hours still nothing solved my problem:can't check if a key does exist in the localStorage. In my chat application,Once the user opens a new tab, I want to check ...
user8244016's user avatar
  • 1,029
0 votes
2 answers
4k views

I need to check if there is any key in localStorage This code did not work if (localStorage.user === undefined) { alert('There is no key!'); }
Hugo Nascimento's user avatar
6 votes
2 answers
991 views

I'm working with Ionic framework as part of an online course I'm taking to learn AngularJS and a great many other tools useful to a web developer. And, being the sort of advanced beginner type, I'm ...
Zeke's user avatar
  • 216
-1 votes
2 answers
3k views

I have a project on pure javascript,and I was working on saving items to localstorage. I only need to save id, name and image of the item i am saving. My major problem , however is i do not want save ...
Seyyid Said's user avatar
0 votes
2 answers
2k views

Based on this answer I should be using $.inArray, therefore I do: var curPostId = $(".my_post_id").attr("data-id"); if($.inArray(curPostId, lines)) { $('#'+localStorage.getItem('saveButton')).attr(...
rob.m's user avatar
  • 10.7k
2 votes
1 answer
1k views

var bookobj = { Name: name, Author: author, Edition: edi, Price: pri } var arr = []; if(localStorage === null){ localStorage.setItem("Arrayobj", JSON.stringify(bookobj)); } else { ...
Dadhich Sourav's user avatar
1 vote
1 answer
2k views

I painted this picture to demonstrate what my final goal is. Short description: If nothing is changed in form or there's already exact same values saved, "save values" button does nothing If something ...
AWA's user avatar
  • 446
0 votes
2 answers
2k views

I have a pop up tutorial (basically slider) that will show upon first launch in the app. This is what I wrote in the controller.js //show first time tutorial if(localStorage.getItem("second") != "...
Louis Cheng's user avatar

15 30 50 per page