{"id":19030513,"url":"https://github.com/sofish/storage.js","last_synced_at":"2026-05-02T18:30:15.818Z","repository":{"id":4060923,"uuid":"5164492","full_name":"sofish/storage.js","owner":"sofish","description":"a jQuery plugin that make text storage works with all mayor browsers (include IE6+)","archived":false,"fork":false,"pushed_at":"2012-07-29T12:33:19.000Z","size":107,"stargazers_count":19,"open_issues_count":0,"forks_count":4,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-01-02T03:44:59.840Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sofish.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-07-24T11:04:43.000Z","updated_at":"2018-09-17T09:07:57.000Z","dependencies_parsed_at":"2022-07-29T01:38:54.766Z","dependency_job_id":null,"html_url":"https://github.com/sofish/storage.js","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sofish%2Fstorage.js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sofish%2Fstorage.js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sofish%2Fstorage.js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sofish%2Fstorage.js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sofish","download_url":"https://codeload.github.com/sofish/storage.js/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240079638,"owners_count":19744725,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-08T21:18:19.774Z","updated_at":"2026-05-02T18:30:15.788Z","avatar_url":"https://github.com/sofish.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"### Cross-Browser \u0026 Cross-Page Text Storage \\[localStorage\\]\n\n------------------------------------------------\n### \\# files:\n\n```bash\n.\n├── index.html\t\t\t\t\tdemo page\n├── jquery-storage.js\t\t\t\tjQuery plugin\n├── readme.md\t\t\t\t\t\n└── storage.html\t\t\t\t\tiframe source with textStorage.js\n```\n\n### \\# useage: \n\nit works cross-page and cross-browser(include IE6+).\n\n__Note__ that it is a fallback for native `localStorage`. if your app only works on IE8+ and other morden browsers, you'll never need this. \nmeanwhile, if a single page app that need to work with `lt IE8`, you can use [textStorage.js](https://gist.github.com/1221115)\n\notherwise, you can use it like this:\n\n```js\n// the storage object have 4 method\n$('SOME SELECTOR').storage\n\n// get a item from the local storage\n.get(key)\n\n// set a value to a item\n.set(key, value)\n\n// remove a item from the local storage\n.remove(key)\n\n// clear all stored items\n.clear()\n```\n\na sample:\n\n```js\n$('body').storage.set('keyName', 'the value of the key');\n$('body').storage.get('keyName'); // 'the value of the key'\n```\n\n### \\# set a right path to the iframe\n\n```js\n// you can find the line at storage.js\n// make sure the path of 'storage.php' is set correctly\niframe.attr('src', './storage.php');\n```\n\n### \\# cross domain:\n\nif your app need to works with pages that have different sub-domain. you need to add one more line on both `jquery-storage.js` and `storage.html`:\n\n```js\ndocument.domain = 'YOUR DOMAIN HOST';\n```\nfor example, if you have `a.example.com` and `b.example.com` to host the files, you need to do like this:\n\n```js\n//storage.js\ndocument.domain = 'example.com';\n// the other code\n// ...\n```\n```html\n\u003c!-- storage.html --\u003e\n\u003cscript type=\"text/javascript\"\u003e\ndocument.domain = 'example.com';\n...\n\u003cscript\u003e\n```\n\nNote that the fallback will not work with cross host. such as working with `example.com/storage.js` and `github.com/storage.html`. but you're very welcome to commit a cross host solution.\n\n### \\# license:\n\nuse the MIT License, you can use, modify and even more actions as you like without permition. \n\n\nCopyright (C) 2012 Sofish Lin http://sofish.de\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of\nthis software and associated documentation files (the \"Software\"), to deal in\nthe Software without restriction, including without limitation the rights to\nuse, copy, modify, merge, publish, distribute, sublicense, and/or sell copies\nof the Software, and to permit persons to whom the Software is furnished to do\nso, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsofish%2Fstorage.js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsofish%2Fstorage.js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsofish%2Fstorage.js/lists"}