local-storage

Accessing localStorage in Protractor test for AngularJS application

浪尽此生 提交于 2019-12-18 12:16:40
问题 I am writing some tests to verify that input data is being stored in local storage correctly, how can I access localStorage from within the protractor test? ... describe('vgPersist', function() { it('Should save input data in local storage until form submitted', function() { // Prepare Object and Open browser var addOns = new AddOns(); addOns.get(); -> Clear localStorage -> Get from localStorage How do you use executeScript? And could I get data from an executeScript? 回答1: To get an item from

rxjs observable angular 2 on localstorage change

家住魔仙堡 提交于 2019-12-18 10:44:34
问题 I am trying to create an observable that returns values when changes to a localStorage variable happens. My subscriber is not getting the new values upon changes to localStorage (or for that matter an in memory variable). navbar.component.js import { Component, OnInit } from '@angular/core'; import { UserService } from '../services/user.service'; /** * This class represents the navigation bar component. */ @Component({ moduleId: module.id, selector: 'sd-navbar', templateUrl: 'navbar.component

Chromium localStorage not showing in Developer Tools

怎甘沉沦 提交于 2019-12-18 10:39:42
问题 Trying to view my test localStorage , I see nothing in the Storage section under Applications in the Developer Tools. However, using the console, I can access it, meaning its clearly there. Am I missing something or does this seem to be a bug I couldn't find anything about? I am using Chromium Version 57.0.2978.0 (64-bit) 回答1: Its a known Bug (#701413) They fixed it in version 59.0.3069.0 (#718482) I can see the localStorage of different domains like FB, but not from the current domain. When

iOS 'Web App' has different localStorage than Mobile Safari

喜夏-厌秋 提交于 2019-12-18 10:31:42
问题 I have a webapp for iPad with the meta tag: <meta name="apple-mobile-web-app-capable" content="yes"> When I open up the app from the homepage (web-app-capable version) or type in the address in Mobile Safari the contents of localStorage are different. I have confirmed that the addresses are identical by printing location.href. All changes made to localStorage while using Mobile safari are reflected in the web-app-capable version, but changes made in the web-app-capable version are not

Are there any drawbacks to using localStorage instead of Cookies?

坚强是说给别人听的谎言 提交于 2019-12-18 10:27:17
问题 On my previous websites, I used to use a cookie to display a pre-home page only on the first visit. That worked great (see for example here), but using cookies is not so trendy today, so I want to avoid it as much as possible. Now, my new website projects almost always have pre-home launched via javascript (showing a modalbox), so I don't need to do any action on the server side. I'm considering to use HTML5 localStorage instead of cookies, with a fallback on cookies if the browser does not

Timer refreshes after browser page is reloaded - Javascript

人盡茶涼 提交于 2019-12-18 09:53:27
问题 I built a countdown timer with the help of people from this platform a few days back. I thank them all for that. But I have run into another issue. When I refresh the page, the whole timer is reset and everything goes back to normal. I looked it up and realised I need to store seconds in something called the local storage of the browser. But how to implement it into my code is the problem. Similar issues like mine have different ways of solving this. I tried changing it to theirs but had the

Remove array item from localstorage

北城以北 提交于 2019-12-18 09:25:24
问题 I have an array i stored(parsed it as json) in localstorage. I got it back into an object, removed some items from it and i need to update the key with the new values in the local storage. var counter = [0,1,2]; var count = counter[0]; var questions = localStorage.getItem('questions');///questions had been stored in local storage with another function console.log(questions); questions = $.parseJSON(questions); if (questions != 0){ $('.question').html(questions[count]['question']); var options

Is it possible to override Local Storage and Session Storage separately in HTML5?

谁都会走 提交于 2019-12-18 08:54:53
问题 I know it's possible to override the HTML5 storage APIs by overriding Storage.prototype.getItem, setItem, removeItem and clear. But that will override those methods for both local storage and session storage. Is it possible to just override one and not the other? Or to override both separately? A little context: I have an existing app that makes very heavy use of both local storage and session storage. I want to add some temporary code to mirror the stuff in local storage in another storage

localStorage Size Limits… What are the options?

走远了吗. 提交于 2019-12-18 08:26:20
问题 I plan to use persistant localStorage in one of my projects and i have found out that the size limitation is 5 MB (chrome). I searched other frameworks which implmented the same thing, like Mootools, Dojo, Lawnchair but i couldnt find out what are their size limitations. Does anyone know what are the size limitation is in these. And what other options are there which i can use if not the one already stated above. 回答1: localstorage limits are not tied to the javascript framework, but to the

Clear localStorage and change the view Backbone

允我心安 提交于 2019-12-18 07:23:28
问题 Hey so I am using backbone localstorage and every time someone hits the search button I want to clear the localstorage so I can just add the new data to the localStorage. Also, trying to figure out how to then redirect the user to a new view after the success callback in for the localstorage being set, I know there is view.remove() but I am not sure how to use that being that the callback is within the view and also, where/how to render the new view... Let's say the new view is PageView...