Sometimes you want to save content, a text for example directly from the browser, without talking to a server.
Here I use the nice library FileSaver
<textarea id="notes" style="width:300px; height: 100px;">
Content
</textarea>
<br />
<button onclick="saveContent()">
Save
</button>
<script>
function saveContent () {
let data = notes.value
var blob = new Blob([data], {type: "text/plain;charset=utf-8"});
var name = prompt("Save file under")
if (name != "" ) {
saveAs(blob, name)
}
}
</script>
You can test it here SaveContent
Top comments (1)
Yes, saving content from your browser can be useful, especially when you want to save important information locally. But it's worth keeping security in mind, because a lot of data can be vulnerable. For example, using mfa to protect the accounts where such content is stored helps to ensure strong protection against unauthorized access. If interested, you can read more about multi-factor authentication at this link: Multi-Factor Authentication