-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathindex.html
More file actions
51 lines (46 loc) · 2.52 KB
/
Copy pathindex.html
File metadata and controls
51 lines (46 loc) · 2.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<html>
<head>
<title>Backup and restore local storage buttons</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta name="viewport" content="width=device-width">
<meta http-equiv="Cache-control" content="public">
<link rel="stylesheet" type="text/css" href="main.css"/>
<script type="text/javascript" src="functions.js"></script>
<script type="text/javascript" src="main.js"></script>
</head>
<body>
<div id="container">
<h1 id="header">Backup and restore local storage</h1>
<h3>Usage</h3>
<ol>
<li>Drag the following buttons and drop them into your bookmarks. They are so called <a href="https://en.wikipedia.org/wiki/Bookmarklet">bookmarklets</a>. </li>
<li>Open site you want to backup / restore and click on this bookmarked button.</li>
</ol>
<h3>Backup</h3>
<p>
Takes all key-value pairs from your local storage and serves them to download as a JSON file.
</p>
<a class="btn" href="#" data-function="localStorageBackup">Backup local storage</a>
<h3>Restore</h3>
<p>
Creates overlay in current page with one file selector. Select file with backups. All items will be automatically restored.
</p>
<a class="btn" data-function="localStorageRestore" href="#">Restore local storage</a>
<h3>Clear</h3>
<p>
Removes all items from local storage.
</p>
<a class="btn" data-function="localStorageClear" href="#">Clear local storage</a>
<h3>Security, privacy</h3>
<p>All operations are executed locally. There is no server side, no tracking, no server uploads.
HTML5 provides necessary functionality like <a href="https://developer.mozilla.org/en-US/docs/Web/API/FileReader">File API</a>.
You can always examine the source code of bookmarklets and the <a href="https://github.com/todvora/localstorage-backup">repository itself</a>.</p>
<h3>Limitations</h3>
<a href="https://en.wikipedia.org/wiki/Content_Security_Policy">Content-Security-Policy</a> can block execution of script stored as a <a href="https://en.wikipedia.org/wiki/Bookmarklet">bookmarklet</a>. in this case backup and restore doesn't work.
<div id="footer">
<p>Created by <a href="http://www.tomas-dvorak.cz">Tomáš Dvořák</a>. Found a bug or enhancement? <a href="https://github.com/todvora/localstorage-backup">Pull requests</a> welcome.
</p>
</div>
</div>
</body>
</html>