Search Results

Search found 103 results on 5 pages for 'localstorage'.

Page 1/5 | 1 2 3 4 5  | Next Page >

  • How do I include 2 tables in LocalStorage?

    - by Noor
    I've got a table that you can edit, and I've got a simple code saving that list when you're done with editing it. (the tables have the contenteditable on) The problem I've stumbled upon is that if I double click on enter, the table gets divided into two separate tables with the same ID. This causes the code I'm using to set the localStorage to only store one of the tables (I assume the first).. I've thought of different solutions and I wonder if someone could point out the pro's and con's (if the solutions even works that is). Make a loop that checks the page after tables and stores them into an array of localStorage-items.. I'd have to dynamically create a localStorage item for each table. Take the whole div that the tables are in, and store that in the localStorage, when a user revisits the page, the page checks after the items in storage and displays the whole divs. Any suggestions you have that can beat this :).. (but no cache, it has to be with the localStorage!) Thanks

    Read the article

  • Listing localstorage

    - by Blondie
    I did my own feature using this: function save(title, url) { for (var i = 1; i < localStorage.length; i++) { localStorage["saved-title_" + i + ""] = title; localStorage["saved-url_" + i + ""] = url; } } function listFavs() { for (var i = 1; i < localStorage.length; i++) { console.log(localStorage["saved-fav-title_" + i + ""]); } } save() happens when someone clicks on this: onclick="save(\'' + title + '\', \'' + tab.url + '\');"> ' + title + '</a>'; However... it doesn't show the saved localStorages, how am I supposed to make it work?

    Read the article

  • iPhone Safari localStorage does not persist after device reboot

    - by Tom
    Hi, I write a simple iPhone web app using HTML5's localStorage. Tests on a 2G device show the data does not persist after an iPhone reboot. This is a test code: <html> <head> <meta name="viewport" content="height=device-height, width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" /> </head> <body> <script> alert("1:" + localStorage.getItem("test")); localStorage.setItem("test", "123"); alert("2:" + localStorage.getItem("test")); </script> </body> As far as I understand the data should persist even after a device reboot. Can anyone shed some light on this behavior? Thanks! Tom.

    Read the article

  • Chrome extension - Localstorage not working

    - by Bjarki Jonasson
    I'm writing a Chrome extension that uses a content script to modify certain parts of a website. The content script worked fine until I tried to add an options page to my extension. Right now I'm using an options.html file to save user preferences to localstorage, as you can see here: <html> <head><title>Options</title></head> <script type="text/javascript"> function save_options() { var select = document.getElementById("width"); var width = select.children[select.selectedIndex].value; localStorage["site_width"] = width; } function restore_options() { var fwidth = localStorage["site_width"]; if (!fwidth) { return; } var select = document.getElementById("width"); for (var i = 0; i < select.children.length; i++) { var child = select.children[i]; if (child.value == fwidth) { child.selected = "true"; break; } } } </script> <body onload="restore_options()"> Width: <select id="width"> <option value="100%">100%</option> <option value="90%">90%</option> <option value="80%">80%</option> <option value="70%">70%</option> </select> <br> <button onclick="save_options()">Save</button> </body> </html> I also have a background.html file to handle the communication between the content script and the localstorage: <html> <script type="text/javascript"> chrome.extension.onRequest.addListener(function(request, sender, sendResponse) { if (request.method == "siteWidth") sendResponse({status: localStorage["site_width"]}); else sendResponse({}); }); </script> </html> Then there's the actual content script that looks like this: var Width; chrome.extension.sendRequest({method: "siteWidth"}, function(response) { width = response.status; }); None of that code actually works. It looks solid enough to me but I'm not a very experienced programmer so I might be wrong. Could someone explain localstorage to me in layman's terms?

    Read the article

  • Multiple storages using localStorage

    - by Blondie
    Hey, Is it possible that the same name used can have many different values stored separately and to be shown in a list? e.g. function save() { var inputfield = document.getElementById('field').innerHTML; localStorage['justified'] = inputfield; } <input type="text" id="field" onclick="save();" /> Everytime someone enters something in the input field, and click on save, the localstorage will only save the value in the same name, however, does this conflict the way storage are saved, like being replaced with the latest input value? Also, is there anyway to prevent clearing the localstorage when clearing the cache? Thanks.

    Read the article

  • Structuring input of data for localStorage

    - by WmasterJ
    It is nice when there isn't a DB to maintain and users to authenticate. My professor has asked me to convert a recent research project of his that uses Bespin and calculates errors made by users in a code editor as part of his research. The goal is to convert from MySQL to using HTML5 localStorage completely. Doesn't seem so hard to do, even though digging in his code might take some time. Question: I need to store files and state (last placement of cursor and active file). I have already done so by implementing the recommendations in another stackoverflow thread. But would like your input considering how to structure the content to use. My current solution Hashmap like solution with javascript objects: files = {}; // later, saving files[fileName] = data; And then storing in localStorage using some recommendations localStorage.setObject(files): Currently I'm also considering using some type of numeric id. So that names can be changed without any hassle renaming the key in the hashmap. What is your opinion on the way it is solved and would you do it any differently?

    Read the article

  • Listing down stored records localStorage | Google Chrome Extensions

    - by Jamie
    How do I get to list down the stored records in the for loop? Basically I want it to list down the records like this: '<div id="record_' + number + '">' + localstorage value + '</div>' The number in the class should add 1 every record, e.g. 1, 2, 3, 4 every record it lists down, and so on. The localstorage value should show the localStorage[] but the problem is, the localStorage name has the same, e.g. (clicks on button) it will save the value of the URL into a localStorage I then open the application and shows the window.html inside there is list of stored records by using this: '<div id="record_' + number + '">' + localstorage value + '</div>' INCLUDING the record number to add per record 1, 2, 3, etc... like this: <div id="record_1">localstorage value</div> <div id="record_2">localstorage value</div> <div id="record_3">localstorage value</div> <div id="record_4">localstorage value</div> <div id="record_5">localstorage value</div> <div id="record_6">localstorage value</div> etc...

    Read the article

  • Calculating usage of localStorage space

    - by WmasterJ
    I am creating an app using the Bespin editor and HTML5's localStorage. It stores all files locally and helps with grammar, uses JSLint and some other parsers for CSS and HTML to aid the user. I want to calculate how much of the localStorage limit has been used and how much there actually is. Is this possible today? I was thinking for not to simply calculate the bits that are stored. But then again I'm not sure what more is there that I can't measure myself.

    Read the article

  • HTML5 localStorage restrictions and limits

    - by Chuck
    HTML5's localStorage databases are usually size-limited — standard sizes are 5 or 10 MB per domain. Can these limits be circumvented by subdomains (e.g. example.com, hack1.example.com and hack2.example.com all have their own 5 MB databases)? And is there anything in the standard that specifies whether parent domains can access their children's databases? I can't find anything, and I can see arguments for doing it either way, but it seems like there has to be some standard model.

    Read the article

  • Import/Export HTML5 localStorage data

    - by hamen
    Hi all, I'm working on a simple TODO list app based on localStorage HTML5 feature: http://hamen.github.com/webnotes/ I'm wondering if it's possible to import/export data in some way. How could I provide an "Export note/Import note" feature to make users being able to save their note on their HD and import them in another browser profile? Thanks

    Read the article

  • Newbie want to learn: Javascript + HTML5 localstorage

    - by Alai
    So I'm searching for a good crash course on localstorage and interacting with it in Javascript. I want to build a to-do list webapp with some extra functionality but it would be just for 1 user. I don't want to mess with php/mysql and have the server doing anything. Links to tutorials would be best :-D

    Read the article

  • Max size of localStorage values?

    - by user269386
    Hi, since the localStorage (currently) only supports strings as values and in order to that the objects have to be stringified (stored as JSON-string), before they can be stored, i wondered if there is a defined limitation regarding the length of the values. Does anyone know if there is a definition which applies to all browsers, respectively does anyone know the limitations for Chrome5? Thanks, in advance, for your help

    Read the article

  • localstorage vs html5?

    - by Mark
    What's the difference between local/html5 on this page: http://code.google.com/p/jquery-jstore/wiki/DefaultEngines I was under the impression that I could use localstorage on Chrome, but looks like that's not the case? Some elucidation would be greatly appreciated. Thanks.

    Read the article

  • Javascript + HTML5 localstorage

    - by Alai
    So I'm searching for a good crash course on localstorage and interacting with it in Javascript. I want to build a to-do list webapp with some extra functionality but it would be just for 1 user. I don't want to mess with php/mysql and have the server doing anything. Links to tutorials would be best :-D

    Read the article

  • HTML5 localStorage for assets (stylesheets, JavaScript, images etc)

    - by Sam
    To save both client download time and network usage, is it possible to use the localStorage feature of HTML5 to store contents of linked stylesheets, javascript files and binary data (e.g. images), rather than hitting the server each time? Would that just complicate things - since I assume you would have to add the linked asset via JavaScript rather than just a script or link element, breaking the page for those without JavaScript enabled)? Unless you can parse the content (using HEAD requested to check last modified date and other headers) before the browser downloads it. Or best just to stick with 304 Not Modified and eTag headers?

    Read the article

  • How do I include 2 tables in one LocalStorage item?

    - by Noor
    I've got a table that you can edit, and I've got a simple code saving that list when you're done with editing it. (the tables have the contenteditable on) The problem I've stumbled upon is that if I double click on enter, the table gets divided into two separate tables with the same ID. This causes the code I'm using to set the localStorage to only store one of the tables (I assume the first).. I've thought of different solutions and I wonder if someone could point out the pro's and con's (if the solutions even works that is). Make a loop that checks the page after tables and stores them into an array of localStorage-items.. I'd have to dynamically create a localStorage item for each table. Take the whole div that the tables are in, and store that in the localStorage, when a user revisits the page, the page checks after the items in storage and displays the whole divs. Any suggestions you have that can beat this :).. (but no cache, it has to be with the localStorage!) Thanks

    Read the article

  • HTML5 on iPhone Safari - data stored by localStorage does not always persist. Why?

    - by Aerodyne
    Hi, I write a simple iPhone web app using HTML5's localStorage. Tests on a 2G device show that data stored using localStorage does not persist after the Safari process is killed although the opened Safari windows are remembered. The data is also lost in a case where I am on a different site on a different Safari window, then I change the window to where the web app in subject is shown. When Safari loads the page it automatically refreshes the page. Then the data is lost. This is a simple test code: <html> <head> <meta name="viewport" content="height=device-height, width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" /> </head> <body> <script> alert("1:" + localStorage.getItem("test")); localStorage.setItem("test", "123"); alert("2:" + localStorage.getItem("test")); </script> </body> As far as I understand the data should persist! Can anyone shed some light on this behavior? What should I do to get the persistence to work? Thanks! Tom.

    Read the article

  • JavaScript loop stops on "localStorage.removeItem"

    - by user1755603
    Why is the "localStorage.removeItem" stopping the loop? If I remove "localStorage.removeItem" and only leave the "alert", it loops though whole thing, but with "localStorage.removeItem" it stops on the first match. function removeTask() { for (i=0; i < localStorage.length; i++){ checkbox = document.getElementById('utford'+i); if (checkbox.checked == true) { alert(i); localStorage.removeItem(localStorage.key(i)); } } printList(); }

    Read the article

  • Suitable data structures for saving files in localStorage (HTML5) ?

    - by WmasterJ
    It is nice when there isn't a DB to maintain and users to authenticate. My professor has asked me to convert a recent research project of his that uses Bespin and calculates errors made by users in a code editor as part of his research. The goal is to convert from MySQL to using HTML5 localStorage completely. Doesn't seem so hard to do, even though digging in his code might take some time. Question: I need to store files and state (last placement of cursor and active file). I have already done so by implementing the recommendations in another stackoverflow thread. But would like your input considering how to structure the content to use. My current solution Hashmap like solution with javascript objects: files = {}; // later, saving files[fileName] = data; And then storing in localStorage using some recommendations localStorage.setObject("files", files); // Note that setObject(key, data) does not exist but is added // using Storage.prototype.setObject = function() {... Currently I'm also considering using some type of numeric id. So that names can be changed without any hassle renaming the key in the hashmap. What is your opinion on the way it is solved and would you do it any differently?

    Read the article

  • Architecture for data layer that uses both localStorage and a REST remote server

    - by Zack
    Anybody has any ideas or references on how to implement a data persistence layer that uses both a localStorage and a REST remote storage: The data of a certain client is stored with localStorage (using an ember-data indexedDB adapter). The locally stored data is synced with the remote server (using ember-data RESTadapter). The server gathers all data from clients. Using mathematical sets notation: Server = Client1 ? Client2 ? ... ? ClientN where, in general, a record may not be unique to a certain client. Here are some scenarios: A client creates a record. The id of the record can not set on the client, since it may conflict with a record stored on the server. Therefore a newly created record needs to be committed to the server - receive the id - create the record in localStorage. A record is updated on the server, and as a consequence the data in localStorage and in the server go out of sync. Only the server knows that, so the architecture needs to implement a push architecture (?) Would you use 2 stores (one for localStorage, one for REST) and sync between them, or use a hybrid indexedDB/REST adapter and write the sync code within the adapter? Can you see any way to avoid implementing push (Web Sockets, ...)?

    Read the article

  • How to save a HTMLElement (Table) in localStorage?

    - by Hagbart Celine
    I've been trying this for a while now and could not find anything online... I have a project, where tablerows get added to a table. Works fine. Now I want to save the Table in the localStorage, so I can load it again. (overwrite the existing table). function saveProject(){ //TODO: Implement Save functionality var projects = []; projects.push($('#tubes table')[0].innerHTML); localStorage.setItem('projects', projects); //console.log(localStorage.getItem('projects')); The problem is the Array "projects" has (after one save) 2000+ elements. But all I want is the whole table to be saved to the first (or appending later) index. In the end I want the different Saves to be listed on a Option element: function loadSaveStates(){ alert('loading saved states...'); var projects = localStorage.getItem('projects'); select = document.getElementById('selectSave'); //my Dropdown var length = projects.length, element = null; console.log(length); for (var i = 0; i < length; i++) { element = projects[i]; var opt = document.createElement('option'); opt.value = i; opt.innerHTML = 'project ' + i; select.appendChild(opt); } } Can anyone tell me what I am doing wrong?

    Read the article

  • localStorage not working in IE9 and Firefox

    - by maha
    I am working with localStorage. My code is perfectly working in Chrome, but not in IE9 and Firefox. Here is the code: document.addEventListener("DOMContentLoaded", restoreContents, false); document.getElementsByTagName("body")[0].onclick=function(){saveContents('myList','contentMain', event, this);}; function amIclicked(e, eleObject) { alert("amIClicked"); e = e || event; var target = e.target || e.srcElement; alert("target = " + target.id); if(target.id=='pageBody' || target.id=='Save') return true; else return false; } function saveContents(e, d, eveObj, eleObject) { //alert("saveContents"); if (amIclicked(eveObj, eleObject)) { var cacheValue = document.getElementById(e).innerHTML; var cacheKey = "key_" + selectedKey; var storage = window.localStorage; //alert ("cacheKey = " + cacheKey + " ,cacheValue = " + cacheValue); if(typeof(Storage)!=="undifined"){ localStorage.setItem("cacheKey","cacheValue"); } //alert ("Saved!!"); var dd = document.getElementById(d); //document.getElementById("contentMain").style.display == "none"; dd.style.display = "none"; } } function restoreContents(e,k) { //alert("test"); if(k.length < 1) { return; } var mySavedList = localStorage["key_" + k]; if (mySavedList != undefined) { document.getElementById(e).innerHTML = mySavedList; } } <a onclick="ShowContent('contentMain','myList','Sample_1'); return true;" href="#" >Sample 1</a><br/><br/> <a onclick="ShowContent('contentMain','myList','Sample_2'); return true;" href="#" >Sample 2</a><br/><br/> <div style="display:none;display:none;position:absolute;border-style: solid;background-color: white;padding: 5px;"id="contentMain"> <ol id="myList" contenteditable="true"> <li>Enter Content here</li> </ol> <!--<input id="editToggleButton" type="button" value="Edit"/>--> </div> When I debugging in Iexplore Iam getting the error as SCRIPT5007: Unable to get value of the property 'length': object is null or undefined sample_1.html, line 157 character 3 Thanks

    Read the article

  • Ember Data Sycn - LocalStorage+REST+RealTime+Online/Offline

    - by Miguel Madero
    We have a combination of requirements in terms o data access. Pre-load some reference data. We need reference data to survive browser restarts instead of just living in memory to avoid loading it all the time. I'm currently using the LocalStorageAdapter for that. Once we have it, we would like to sync changes (polling or using Socket.IO in the background and updating the LocalStorage could do the trick) There're other models that are more transactional, where we would need to directly go to the Server and get/save them. It would be nice to use something like the RESTAdapter for that. Lastly, there're some operations that should work off-line and changes should be synced later. To make it more concrete: * We pre-load vendor and "favorite products" into Local Storage. We work offline with those. * We need to sync server changes to vendor and product information. * If they search the full catalog, that requires them to be online. * When offline, we need to allow users to add something to their cart or even submit and order. We would like to queue this action and submit it when they have an Internet Connection. So a few questions are derived from this: * Is there a way to user RESTAdapter in combination with LocalStorage? * Is there some Socket.IO support? (Happy to do this part manually) * Is there Queueing support? Ideally at the Ember-Data level. I know we will have to do a lot of this manually and pull together the different lego pieces, but I wanted to ask for some perspective from experience Ember devs.

    Read the article

  • HTML5 enabled browser for Windows Mobile 6

    - by Herberth Amaral
    I did some research on Google but I couldn't find any HTML5 browser for Windows Mobile 6. The main resource I'm looking for in HTML5 is WebDatabase and/or localStorage. With a little research I found Iris (http://www.freewarepocketpc.net/ppc-download-iris-browser.html), a Webkit based browser with some HTML5 features, but localStorage and Web Database doesn't work on it. Does anyone know any browser with storage capability for Windows Mobile 6?

    Read the article

1 2 3 4 5  | Next Page >