local-storage

How can I use the BroadcastChannel API or something similar in Safari 10+?

陌路散爱 提交于 2020-01-23 17:47:06
问题 Problem: I need a client-side Javascript solution (jQuery is fine) where an event in one browser window/tab can be broadcast to other windows/tabs on the same domain. For example, if a cart is updated in tab A, tabs B and C get notified so we can update some info on the page, or notify the user that page is stale, or something like that. What I've tried: The BroadcastChannel API fits my needs perfectly, but does not work in IE 11 or Safari. So I tried this polyfill so I could use the

Can HTML5 localStorage in Cordova/Phonegap app be synced to iCloud?

帅比萌擦擦* 提交于 2020-01-23 02:56:07
问题 I have a Phonegap/Cordova app that runs on iOS. It saves it's data into HTML5 localStorage. I'm trying to work out if it's possible to sync the localStorage data (using iCloud) to other iOS devices, and even OS X. From what I can see, in iOS localStorage is actually implemented as a SQLite database, which (when using Phonegap/Cordova) is written to the app's Documents directory: Documents/Backups/localstorage.appdata.db I also understand that there are three main ways of storing data in

Application Cache Manifest + Local Storage Size Limit

笑着哭i 提交于 2020-01-23 00:59:37
问题 I'm building an application that might have heavy offline storage needs, and I was wondering if it's possible to use both an offline cache manifest (5MB) as well as localstorage (5MB) to be able to use 10MB of storage. Note that this is an intranet application, so we have control of the devices. 回答1: I have tested this in Chrome, Firefox, Opera and Safari and all browser use for both technique a limit of 5 mb. So it's possible... Note: - The limit of localStorage and Offline Application

Auto SignIn with Vuex and Vuex-persistedstate

一曲冷凌霜 提交于 2020-01-22 17:07:05
问题 I would like to auto-sign-in user when the page has been refreshed. I've read that I should use vuex-persistedstate to persist the token in localstorage . Here's my vuex store: store: { user: null }, actions: { autoSignIn ({commit}, payload) { commit('setUser', { id: payload.token }) } }, mutations: { setUser (state, payload) { state.user = payload; } }, plugins: [ createPersistedState({ getState: (key) => localStorage.getItem(key), setState: (key, state) => localStorage.setItem('user_token',

Why is null stored as a string in localStorage?

删除回忆录丶 提交于 2020-01-21 08:30:45
问题 In the Chrome console I set foo to null: localStorage.setItem("foo",null) Then I test, whether it is null: console.log(localStorage.getItem("foo")==null) prints false . Then I test, whether it is the string "null" : console.log(localStorage.getItem("foo")=="null") prints true . I thought that null was a legitimate Javascript value. Storing it as the string "null" is very counter intuitive and caused a strange bug in an otherwise working program, when I cleared the localStorage in the browser

Why is null stored as a string in localStorage?

纵饮孤独 提交于 2020-01-21 08:28:28
问题 In the Chrome console I set foo to null: localStorage.setItem("foo",null) Then I test, whether it is null: console.log(localStorage.getItem("foo")==null) prints false . Then I test, whether it is the string "null" : console.log(localStorage.getItem("foo")=="null") prints true . I thought that null was a legitimate Javascript value. Storing it as the string "null" is very counter intuitive and caused a strange bug in an otherwise working program, when I cleared the localStorage in the browser

Where is chrome extension's 'chrome.storage.local' data saved?

若如初见. 提交于 2020-01-21 03:11:40
问题 I can find the previous localStorage api data in ~/.config/google-chrome/Default/Local Storage directory. I see that these are sqlite files which I can browse with sqlite3. However, I'm moving from localStorage api to chrome.storage api and saving the information with chrome.storage.local method. Now, how and where are these files are bing saved in my file system? I can't seem to find any information regarding this in their doc. Any help would be highly appreciated. 回答1: For Windows, you can

Loading an image to localStorage and setting an image src to that location

限于喜欢 提交于 2020-01-20 19:55:10
问题 I've successfully allowed for a user to upload an image to local storage but I want to be able to then take that image and fill an image element on the page with that. <h3>Please upload the image you wish to use.</h3> <input id="photoin" type="file" accept="image/*;capture=camera"></input> <a href="#delete_1" data-role="button" onClick="save()">Submit</a> <script> var i = 0; function save(){ var input = document.getElementById("photoin").value; var name = "photo_" + i; localStorage.setItem

localStorage vs sessionStorage vs cookies

纵然是瞬间 提交于 2020-01-19 02:33:28
问题 I am working in an app where I need to keep some data during the user is logged in and I have that question, what is the difference among localStorage, sessionStorage, cookies ??? I was asking what can I use in order to persist some data in the DOM, even if the user refresh the page, some people says: use sessionStorage, or localStorage, then, someone came up with the idea of use ngCookies because it works in every browser, but, which should I use ? 回答1: localStorage and sessionStorage are

jquery localstorage save item even after refresh

牧云@^-^@ 提交于 2020-01-17 03:21:06
问题 I have this code here: <input type="text" id="player"/> <button>join</button> <div id="tournament"></div> and the jQuery: $(document).ready(function(){ $('button').click(function(){ $('#tournament').append( $('#player').val() + '<br/>' ) }); }); If you see the input, you can enter text, click join and it will add it to the #tournament div, now I'm trying to save it with localstorage even if the page is refreshed and I really don't know how to do this, can you help me please? 回答1: Using