从python/Flask应用程序写入HTML5 localStorage [英] Writing to HTML5 localStorage from python/Flask app
本文介绍了从python/Flask应用程序写入HTML5 localStorage的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我知道我需要在python中使用JavaScript API来写入html5 localStorage,因此我正在寻找最简单的方法.
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.
我的要求是与ExtJS Web UI共享Flask REST API写到localStorage的内容.
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!
推荐答案
您需要做的就是添加
<script></script>
标记到您的html文件中,您可以在它们之间使用以下代码.使用以下方法将项目存储在本地存储中:
tag into your html file between which you can use the following code. Store an item in local storage with:
localStorage.setItem('name', 'tom');
使用
var name = localStorage.getItem('name');
这篇关于从python/Flask应用程序写入HTML5 localStorage的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文