Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Writing to HTML5 localStorage from python/Flask app

I know I need to use a JavaScript API in python to write to html5 localStorage, so I am looking for the most straightforward way of doing this.

My requirement is to share what gets written to localStorage by a Flask REST API with an ExtJS Web UI.

Any suggestions would be most welcome!

like image 965
horcle_buzz Avatar asked Jul 26 '15 15:07

horcle_buzz


1 Answers

All you need to do is add a

<script></script> 

tag into your html file between which you can use the following code. Store an item in local storage with:

localStorage.setItem('name', 'tom');

Retrieve it back with

var name = localStorage.getItem('name');
like image 101
shashanka n Avatar answered Nov 15 '22 18:11

shashanka n