VersionIntroductionInstallationLimitations of the "file" protocolFrequently asked questionsSyntax, keywords and built-in functionsStandard distributionimport implementationBrython packagesBrowser interface
Introduction - DOM API
Creating a document Accessing elements Attributes, properties and methods Events Mouse events Keyboard events Focus events Drag events Query string Interactions with Javascript Brython-specific built-in modules
browser
browser.aio browser.ajax browser.html browser.local_storage browser.markdown browser.object_storage browser.session_storage browser.svg browser.template browser.timer browser.webcomponent browser.websocket browser.worker Widgets browser.widgets.dialog browser.widgets.menu interpreter javascript Working with BrythonCookbook |
modules browser.local_storage and browser.session_storageThis module uses the local storage defined in HTML5. The specification can be found following this link What isHTML5 local storage ?:
local_storage is as follows:
Now, if you close your tab, your browser or even your computer when you open again the same browser you will have access to the values stored by thefrom browser.local_storage import storage storage['foo'] = 'bar' print(storage['foo']) 'foo' key in the same scheme://host:port where the key-value pair was
stored.
If you want to remove permanently a key-value pair you can use the following:
The storage object mimics the interface of a dict object, and supports:del storage['foo'] print(storage['foo']) # raises KeyError
keys , values , and items return a list copy instead of a view.
A more complete example using local_storage , a TO-DO list app, can be found
in the iframe below.
|