我无法在WP7上的IE浏览器中运行userData behavior。(注意:这是指WP7中原始的IE7版本,而不是随Mango更新而来的IE9版本。)有人知道这是否是一个错误,还是该行为根本没有被实现或启用?更好的方法是提供解决方案...我还没有找到。
最小测试案例:
<!doctype html>
<html>
<head>
<style>
#store {
behavior:url('#default#userData');
display:none;
}
</style>
</head>
<body>
<div id="store"></div>
<h1>IE userData behavior test
<script>
var storageElement = document.getElementById("store");
storageElement.setAttribute('monkey', 'fez');
try {
storageElement.save('storagetest');
alert('Saved some data with the storage Element!'); // IE 7,8,9
} catch(e) {
alert("Failed to save data with the storage Element."); // IE on WP7
}
</script>
</body>
</html>
(http://jsbin.com/urepoq/edit)
localStorage
。 - Andy ElocalStorage
,我并不是指当前的浏览器。我会把你的权威语录加入到我的答案中,以使其同样具有权威性 :-) - Andy E