【发布时间】:2016-12-29 08:46:51
【问题描述】:
index.html 文件目前如下所示:
<!DOCTYPE html><html><head style="overflow: hidden; margin:0; padding:0;border:0;">
<meta charset='UTF-8'/>
<meta http-equiv="Content-Security-Policy" content="default-src *; style-src 'self' 'unsafe-inline'; script-src * 'unsafe-inline' 'unsafe-eval'" />
</head>
<body style="overflow: hidden; margin:0; padding:0; width:100vw; height:100vh;border:0;">
<iframe src="http://domain.com" style="overflow: hidden; margin:0; padding:0; width:100vw; height:100vh;border:0;"></iframe>
</body>
<script type=text/javascript>
alert(window.localStorage.getItem("aaa"));
window.localStorage.setItem("aaa", "111")
</script>
</html>
脚本中的警报确实会在应用程序重新启动时保留。
无论 iframe 使用何种 localStorage,在应用程序重新启动时会被清除,从而使 iframe 的使用不等于伪意图。
【问题讨论】:
标签: cordova web local-storage phonegap-plugins cordova-plugins