UserData usage summary produced by lanyu_javascript skills
UserData is a storage space specially opened by Microsoft in the system for IE, so it only supports the combination of Windows IE. The actual test was in 2000 (IE5.5), XP (IE6, IE7 ), it can be used normally under Vista (IE7). Where is
?
Under XP, it is usually located in C:Documents and Settings username UserData. Sometimes it is located in C:Documents and SettingsusernameApplication DataMicrosoftInternet ExplorerUserData.
Under Vista, located in C:UsersusernameAppDataRoamingMicrosoftInternet ExplorerUserData.
Capacity
The web page production manual says this:
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
When used online, the size limit of a single file is 128KB, under one domain name A total of 1024KB files can be saved, and there should be no limit to the number of files. In restricted sites, these two values are 64KB and 640KB respectively, so if various circumstances are taken into account, it is best to control a single file to be less than 64KB.
How to use?
Use the following JS statement to create an object that supports UserData:
o = document.createElement('input');
o.type = "hidden";
o. addBehavior ("#default#userData");
//UserData.o.style.behavior = "url('#default#userData')" ;
//The above statement has the same effect
document.body.appendChild(o);
To put it bluntly, UserData is a Behavior in the style, so it is the same when written like this:
UserData can be bound to most html tags, Specifically:
A, 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, XM
UserData object has the following attributes and methods:
Attribute
Description
expires
Set or read the file expiration time
XMLDocument
Read the XML DOM of the file
Method
Description
getAttribute
Read the value of the specified attribute
load
Open the file
removeAttribute
Remove the specified attribute
save
Save the file
setAttribute
Assign a value to the specified attribute
The UserData file is actually an XML file, and the string is saved through the file name->attribute, such as the following code:
o.setAttribute("code", "hello world!");
o.save("baidu");
After execution, a baidu[1].xml file will be generated in the UserData folder , the content is:
A file can have multiple attributes, which means it can store a variety of different data.
In the music box link saving project, a UserData class is encapsulated, so that UserData can be used more conveniently. The code is as follows:
/**@class defines the operation of userdata*/
var UserData = {
// Define userdata object
o : null,
// Set file expiration time
defExps: 365,
//Initialize userdate object
init: function(){
if(!UserData.o){
try{
UserData.o = document.createElement('input') ;
UserData.o.type = "hidden";
//UserData.o.style.behavior = "url('#default#userData')" ;
UserData.o.addBehavior ("# default#userData");
document.body.appendChild(UserData.o);
}catch(e){
return false;
}
};
return true;
},
// Save the file to the userdata folder f-file name, c-file content, e-expiration time
save : function(f, c, e){
if( UserData.init()){
var o = UserData.o;
// Keep the object consistent
o.load(f);
// Store the incoming content as a property
if(c) o.setAttribute("code", c);
//Set file expiration time
var d = new Date(), e = (arguments.length == 3) ? e : UserData.defExps;
d.setDate(d.getDate() e);
o.expires = d.toUTCString();
// Save as the specified file name
o.save (f);
}
},
// Read the specified file from the uerdata folder and return it as a string. f-File name
load: function(f){
if(UserData.init()){
var o = UserData.o;
// Read file
o.load (f);
// Return file content
return o.getAttribute("code");
}
},
// Check whether the userdata file exists f-file name
exist : function(f){
return UserData.load(f) != null;
},
// Delete the specified file f-file name in the userdata folder
remove : function (f){
UserData.save(f, false, -UserData.defExps);
}
//End of UserData function definition
};

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



Detailed explanation of JavaScript string replacement method and FAQ This article will explore two ways to replace string characters in JavaScript: internal JavaScript code and internal HTML for web pages. Replace string inside JavaScript code The most direct way is to use the replace() method: str = str.replace("find","replace"); This method replaces only the first match. To replace all matches, use a regular expression and add the global flag g: str = str.replace(/fi

So here you are, ready to learn all about this thing called AJAX. But, what exactly is it? The term AJAX refers to a loose grouping of technologies that are used to create dynamic, interactive web content. The term AJAX, originally coined by Jesse J

10 fun jQuery game plugins to make your website more attractive and enhance user stickiness! While Flash is still the best software for developing casual web games, jQuery can also create surprising effects, and while not comparable to pure action Flash games, in some cases you can also have unexpected fun in your browser. jQuery tic toe game The "Hello world" of game programming now has a jQuery version. Source code jQuery Crazy Word Composition Game This is a fill-in-the-blank game, and it can produce some weird results due to not knowing the context of the word. Source code jQuery mine sweeping game

This tutorial demonstrates how to create a captivating parallax background effect using jQuery. We'll build a header banner with layered images that create a stunning visual depth. The updated plugin works with jQuery 1.6.4 and later. Download the

Article discusses creating, publishing, and maintaining JavaScript libraries, focusing on planning, development, testing, documentation, and promotion strategies.

The article discusses strategies for optimizing JavaScript performance in browsers, focusing on reducing execution time and minimizing impact on page load speed.

This article demonstrates how to automatically refresh a div's content every 5 seconds using jQuery and AJAX. The example fetches and displays the latest blog posts from an RSS feed, along with the last refresh timestamp. A loading image is optiona

Matter.js is a 2D rigid body physics engine written in JavaScript. This library can help you easily simulate 2D physics in your browser. It provides many features, such as the ability to create rigid bodies and assign physical properties such as mass, area, or density. You can also simulate different types of collisions and forces, such as gravity friction. Matter.js supports all mainstream browsers. Additionally, it is suitable for mobile devices as it detects touches and is responsive. All of these features make it worth your time to learn how to use the engine, as this makes it easy to create a physics-based 2D game or simulation. In this tutorial, I will cover the basics of this library, including its installation and usage, and provide a
