userData Behavior
This topic documents a feature of Binary Behaviors, which are obsolete as of Internet Explorer 10.
Enables the object to persist data in user data.
Syntax
XML <Prefix: CustomTag ID=sIDSTYLE=" behavior:url('#default#userData')"/>HTML <ELEMENT STYLE="behavior:url('#default#userData')"ID=sID>Scripting object . style.behavior = "url('#default#userData')"object . addBehavior ("#default#userData")
Possible Values
Prefix Prefix that associates the CustomTag with an XML namespace. This prefix is set using the XMLNS attribute of the HTML tag. CustomTag User-defined tag. sID String that specifies a unique identifier for the object.
Members Table
The following table lists the members exposed by the userData object.
Attributes/Properties
Property Description expires Sets or retrieves the expiration date of data persisted with the userData behavior. XMLDocument Retrieves a reference to the XML Methods
Method Description getAttribute Retrieves the value of the specified attribute. load Loads an object participating in userData persistence from a UserData store. removeAttribute Removes the specified attribute from the object. save Saves an object participating in userData persistence to a UserData store. setAttribute Sets the value of the specified attribute.
Remarks
Security Alert For security reasons, a UserData store is available only in the same directory and with the same protocol used to persist the store.
Security Alert Using this behavior incorrectly can compromise the security of your application. Data in a UserData store is not encrypted and therefore not secure. Any application that has access to the drive where UserData is saved has access to the data. Therefore, it is recommended that you not persist sensitive data like credit card numbers. For more information, see Security Considerations: DHTML and Default Behaviors.
The userData behavior persists information across sessions by writing to a UserData store. This provides a data structure that is more dynamic and has a greater capacity than cookies. The capacity of the UserData store depends on the security zone of the domain. The following table shows the maximum amount of UserData storage that is available for an individual document and also the total available for an entire domain, based on the security zone.
Security Zone Document Limit (KB) Domain Limit (KB) Local Machine 128 1024 Intranet 512 10240 Trusted Sites 128 1024 Internet 128 1024 Restricted 64 640 See URLACTION_HTML_USERDATA_SAVE for information on how the userData behavior is regulated. See About URL Security Zones Templates for further information on the default URL policy settings for each of the five security zone templates.
The userData behavior persists data across sessions, using one UserData store for each object. The UserData store is persisted in the cache using thesave and load methods. Once the UserData store has been saved, it can be reloaded even if the document has been closed and reopened.
Setting the userData behavior class on the html, head, title, or style object causes an error when the save or load method is called.
The required style can be set inline or in the document header, as follows:
<STYLE>
.storeuserData {behavior:url(#default#userData);}
</STYLE>An ID is optional for userData, but including one improves performance.
The userData behavior is available as of Microsoft Internet Explorer 5, in the Microsoft Win32 and Unix platforms.
Examples
This example uses the userData behavior to preserve information in a UserData Store.
<html>
<head>
<style type="text/css">
.storeuserData {
behavior: url(#default#userData);
}
</style>
<script type="text/javascript">
function fnSaveInput(){
var oPersist=oPersistForm.oPersistInput;
oPersist.setAttribute("sPersist",oPersist.value);
oPersist.save("oXMLBranch");
}
function fnLoadInput(){
var oPersist=oPersistForm.oPersistInput;
oPersist.load("oXMLBranch");
oPersist.value=oPersist.getAttribute("sPersist");
}
</script>
</head>
<body>
<form id="oPersistForm">
<input class="storeuserData" type="text" id="oPersistInput">
<input type="button" value="Load" onclick="fnLoadInput()">
<input type="button" value="Save" onclick="fnSaveInput()">
</form>
</body>
</html>Code example: http://samples.msdn.microsoft.com/workshop/samples/author/persistence/userData_1.htm
The following example uses the userData behavior in a custom tag to preserve information in a UserData Store.
<html xmlns:sdk="">
<head>
<style type="text/css">
sdk\:cacher {
behavior: url(#default#userData);
}
</style>
<script type="text/javascript">
function fnSaveInput(){
cachetag.setAttribute("sPersist",txt1.value);
cachetag.save("cache");
}
function fnLoadInput(){
cachetag.load("cache");
cachetag.value=cachetag.getAttribute("sPersist");
}
</script>
</head>
<body>
<sdk:cacher id="cachetag"></sdk:cacher>
<input type="button" value="Load" onclick="fnLoadInput()">
<input type="button" value="Save" onclick="fnSaveInput()">
<input type="text" id="txt1" value="some value">
</body>
</html>
Applies To
A, ABBR, ACRONYM, ADDRESS, AREA, B, BIG, BLOCKQUOTE, BUTTON, CAPTION, CENTER, CITE, CODE, DD, DEL, DFN, DIR, DIV, DL, DT, EM, FONT,FORM, hn, HR, I, IMG, INPUT type=button, INPUT type=checkbox, INPUT type=file, INPUT type=hidden, INPUT type=image, INPUT type=password,INPUT type=radio, INPUT type=reset, INPUT type=submit, INPUT type=text, KBD, LABEL, LI, LISTING, MAP, MARQUEE, MENU, OBJECT, OL, OPTION,P, PLAINTEXT, PRE, Q, S, SAMP, SELECT, SMALL, SPAN, STRIKE, STRONG, SUB, SUP, TABLE, TEXTAREA, TT, U, UL, VAR, XMP
See Also
userData Behavior的更多相关文章
- Augmenting DOM Storage with IE's userData behavior
http://www.javascriptkit.com/javatutors/domstorage2.shtml Augmenting DOM Storage with IE's userData ...
- js本地存储解决方案(localStorage与userData)
WEB应用的快速发展,是的本地存储一些数据也成为一种重要的需求,实现的方案也有很多,最普通的就是cookie了,大家也经常都用,但是cookie的缺点是显而易见的,其他的方案比如:IE6以上的user ...
- IE中的userData
之前做项目时用到了localstorage,但是考虑到浏览器存在IE8以下不兼容问题,所以来介绍以下IE中的userData. 本地存储解决方案很多,比如Flash SharedObject.Goog ...
- 我项目中使用userData的实例 UserData.js
关于userData的介绍,请参见http://hi.baidu.com/kaisep/blog/item/1da9a3312d2da5a15edf0e87.htmlhttp://hi.baidu.c ...
- JavaScript本地存储实践(html5的localStorage和ie的userData)
http://www.css88.com/archives/3717 JavaScript本地存储实践(html5的localStorage和ie的userData) 发表于 2011年06月11日 ...
- javascript 进阶篇1 正则表达式,cookie管理,userData
首先,什么事正则表达式呢,其实引入概念很多时候并不能帮我们明白它到底是什么,所以我先简单描述下,正则表达式,其实就是一个记录字符串规则则的字符串,等我们看完这一部分,也就能明白它到底是什么了. 基本语 ...
- 利用userData实现客户端保存表单数据
对于多数网页制作的朋友,实现在客户端保存在网页表单上的信息,比较多的是采用Cookie技术来实现,这些功能例如:下拉列表框选择的选项,文本框输入的数据等.事实上,我们可以利用微软DHTML默认行为中的 ...
- 浅析Web数据存储-Cookie、UserData、SessionStorage、WebSqlDatabase
Cookie 它是标准的客户端浏览器状态保存方式,可能在浏览器诞生不久就有Cookie了,为什么需要Cookie 这个东东?由于HTTP协议没有状态,所以需要一个标志/存储来记录客户浏览器当前的状态, ...
- js本地储存userData实例
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head ...
随机推荐
- Wannafly挑战赛18C 异或和
傻逼题,和期望没毛关系... 分开xy坐标,n方直接统计每个坐标的曼蛤顿距离即可.. #include<bits/stdc++.h> #define il inline #define v ...
- 解决web翻转动画闪屏
首先确保backface-visibility: hidden.这样做可以解决大部分闪屏的情况. 然后需要特别注意的是谷歌的浏览器,不管是桌面端还是移动端,在翻转的过程中在该元素上绘制其他元素也会导致 ...
- (转)为什么所有浏览器的user-agent都是Mozilla
最早的时候有一个浏览器叫NCSA Mosaic,把自己标称为NCSA_Mosaic/2.0 (Windows 3.1),它支持文字显示的同时还支持图片,于是Web开始好玩起来. 然后出现了一个新的网页 ...
- SpringBoot日记——实战篇——Url定向
搞定了SpringBoot的一些基础核心的东西,我们需要实践一个项目来确认自己学习的东西能被应用,最初,我们会选择自己写一个登陆页面,这也是每个网站几乎都有的门面. 在写之前,还有一些知识点需要记录— ...
- nodejs学习笔记(3)
在看了Node8的特性后的总结,后续慢慢补充. 主要是针对一些编码规范,Node的v8引擎由于不同于其他语言的解析策略,因此需要注意一些特殊的方面. 1.try/catch使用对代码运行性能影响明显, ...
- Eclipse的汉化问题
最近看了很多我周围的同学,也都是刚开始接触Eclipse,但是都头疼于eclipse的汉化问题. 好在的是,Eclipse的汉化比较简单,不用到网上自己下载汉化包,而且关于这个软件的汉化也非常的多,所 ...
- springboot+elasticsearch实现全局检索
ElasticSearch是一个基于Lucene的搜索服务器.它提供了一个分布式多用户能力的全文搜索引擎,基于RESTful web接口.Elasticsearch是用Java开发的,并作为Apach ...
- tensorflow-gpu在win10下的安装
参考:https://blog.csdn.net/gyp2448565528/article/details/79451212 按照原博主的方法在自己的机器上会有一点小错误,下面的方法略有不同 环境: ...
- tomcat 项目的搭建-【Linux】
- maven实战读书笔记(三)
maven将一系列的步骤都封装为一系列的插件,运行命令后一系列的插件运行
Security Alert For security reasons, a UserData store is available only in the same directory and with the same protocol used to persist the store.