»ç¿ëÀÚ µ¥ÀÌÅͷκÎÅÍ °³Ã¼ÀÇ À¯Áö(persist) µ¥ÀÌÅ͸¦ °¡´ÉÇÏ°ÔÇÑ´Ù.

script object.style.behavior="url('#default#userData')";
object.addBehavior('#default#userData');
HTML <ELEMENT style="behavior:url('#default#userData')" id=idVal>
XML <prefix:CustomTag id=idVal style="behavior:url('#default#userData')" />
Àμö
prefix CustomTag°ú ¿¬°üµÈ XML namespace Á¢µÎ¾îÀÌ´Ù. HTML ű׿¡¼­ xmlns ¾ÖÆ®¸®ºäÆ®·Î ¼³Á¤ÇÑ´Ù.
CustomTag ÀÛ¼ºÀÚ°¡ Á¤ÀÇÇÏ¿© »ç¿ëÇϴ ű×ÀÌ´Ù.
idVal °³Ã¼À» ´ëÇ¥ÇÏ´Â À¯ÀÏÇÑ ÀνÄÀÚ ¹®ÀÚ¿­ÀÌ´Ù.
Ư±â
º¸¾È °æ°í : º¸¾È»óÀÇ ÀÌÀ¯·Î, UserData´Â ÀúÀåµÈ °Í°ú µ¿ÀÏÇÑ µð·ºÅ丮¿¡ µ¿ÀÏÇÑ ÇÁ·ÎÅäÄÝÀ» »ç¿ëÇÏ¿©¾ß¸¸ Á¢¼ÓÇÒ ¼ö ÀÖ´Ù.
º¸¾È °æ°í : ÀÌ ºñÇìÀ̹ö¸¦ Àß ¸ø »ç¿ëÇÏ¸é º¸¾È¹®Á¦¸¦ ¾ß±â½Ãų ¼ö ÀÖ´Ù. UserData¿¡ ÀúÀåµÈ µ¥ÀÌÅÍ´Â ¾Ïȣȭ(encrypt)µÇÁö ¾Ê¾Æ ¾ÈÀüÇÏÁö ¾Ê´Ù. ¾î´À Àû¿ëÀÌ´ø µ¥ÀÌÅÍ°¡ ÀúÀåµÈ µå¶óÀ̺꿡 Á¢¼ÓÇÏ´Â °ÍÀ̹ǷÎ, ½Å¿ëÄ«µå ¹øÈ£µî º¸¾ÈÀ» ¿äÇÏ´Â µ¥ÀÌÅ͸¦ ÀúÀåÇÏÁö ¾Ê¾Æ¾ß ÇÑ´Ù.

UserData ºñÇìÀ̹ö´Â ¼¼¼Çµå¿¡ ´ëÇÑ Á¤º¸¸¦ UserData¿¡ ÀúÀå¿¡ ±â·ÏÇϹǷμ­ À¯ÁöÇÑ´Ù. ÀÌ´Â ´õ ź·ÂÀûÀÌ°í ÄíÅ°º¸´Ù ´õ Å« Å©±âÀÇ Á¤º¸¸¦ °®´Â µ¥ÀÌÅÍ ±¸Á¶¸¦ Á¦°øÇÑ´Ù. UserDataÀÇ ¿ë·®Àº µµ¸ÞÀÎÀÇ ¾ÈÀüÁö¿ª(security zone)¿¡ µû¶ó ´Ù¸£´Ù. ´ÙÀ½ Ç¥´Â ¾ÈÀüÁö¿ª¿¡ µû¶ó °¢ ¹®¼­¿¡¼­¿Í µµ¸ÞÀÎ ÀüüÀûÀÎ UserData ÀúÀåÀÇ ÃÖ´ë ¿ë·®À» º¸¿©ÁØ´Ù. ºê¶ó¿ìÀú µµ±¸¢¡ÀÎÅÍ³Ý ¿É¼Ç¢¡º¸¾È ¼³Á¤¿¡µû¶ó

¾ÈÀüÁö¿ª ¹®¼­ ÇÑ°è(KB) µµ¸ÞÀÎ ÇÑ°è (KB)
Áö¿ª ÄÄÇ»ÅÍ Local Machine 128 1024
·ÎÄ® ÀÎÆ®¶ó³Ý Intranet 512 10240
½Å·ÚÇÒ ¼öÀÖ´Â »çÀÌÆ® Trusted Sites 128 1024
ÀÎÅÍ³Ý Internet 128 1024
Á¦ÇÑµÈ »çÀÌÆ® Restricted 64 640

UserData ºñÇìÀ̹ö´Â °¢ °³Ã¼¸¶´Ù ÇϳªÀÇ UserData ÀúÀåÀ» »ç¿ëÇÏ¿© µ¥ÀÌÅ͸¦ À¯ÁöÇÑ´Ù. UserData ÀúÀåÀº save¿Í load ¸Þ¼­µå¸¦ »ç¿ëÇÏ¿© ij½¬(cache)¿¡ À¯ÁöµÈ´Ù. µ¥ÀÌÅÍ°¡ ÀúÀåµÇ¸é, Explorer°¡ ´Ý°í ´Ù½Ã ¿­´õ¶óµµ ´Ù½Ã ·ÎµùµÉ ¼ö ÀÖ´Ù.

UserData ºñÇìÀ̹ö Ŭ¶ó½º¸¦ html, head, titleÀ̳ª style °³Ã¼¿¡ ¼³Á¤ÇÏ°í, save³ª load ¸Þ¼­µå¸¦ È£ÃâÇÏ¸é ¿À·ù°¡ ¹ß»ýÇÑ´Ù.

ÇÊ¿äÇÑ styleÀº ÀζóÀÎÀ̳ª ¹®¼­ head ¼Ó¿¡¼­ ¼³Á¤ÇÒ ¼ö ÀÖ´Ù.

<STYLE>
.sUserData {behavior:url(#default#userData);}
</STYLE>

UserData¿¡¼­ id´Â ¼±ÅÃÀûÀÎÀÌÁö¸¸, Æ÷ÇÔ½ÃÅ´À¸·Î¼­ È£ÃâÇϰųª ¼º´ÉÀ» Çâ»ó½Ãų ¼ö ÀÖ´Ù.

UserData ºñÇìÀ̹ö´Â IE5ÀÇ Win32¿Í Unix Ç÷§Æ®Æû¿¡¼­ Áö¿øµÈ´Ù.


attribute property ¼³¸í
expires expires UserData ºñÇìÀ̹ö·Î À¯ÁöµÇ´Â µ¥ÀÌÅÍÀÇ ¸¸·á±â°£À» ¹ÝȯÇϰųª ¼³Á¤ÇÑ´Ù.
XMLDocument XMLDocument °³Ã¼¿¡ ¹Ý¿µµÈ XML DOM(Document Object Model)ÀÇ ÂüÁ¶¸¦ ¹ÝȯÇÑ´Ù.

¸Þ¼­µå ¼³¸í
getAttribute ÁöÁ¤µÈ ¾ÖÆ®¸®ºäÆ®ÀÇ °ªÀ» ¹ÝȯÇÑ´Ù.
load userData ÀúÀåÀ¸·ÎºÎÅÍ userData Áö¼Ó¿¡ Âü¿©ÇÏ´Â °³Ã¼¸¦ ·ÎµùÇÑ´Ù.
removeAttribute ÁöÁ¤µÈ ¾ÖÆ®¸®ºäÆ®¸¦ Á¦°ÅÇÑ´Ù.
save userData ÀúÀåÀ¸·Î userData Áö¼Ó¿¡ Âü¿©ÇÏ´Â °³Ã¼¸¦ ÀúÀåÇÑ´Ù.
setAttribute ÁöÁ¤µÈ ¾ÖÆ®¸®ºäÆ®ÀÇ °ªÀ» ¼³Á¤ÇÑ´Ù.

Àû¿ë
°³Ã¼ IE
<ELEMENT style="behavior:url('#default#userData')" id=idVal> IE5(win32,unix)
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 XMP

userData ºñÇìÀ̹ö ¿¹Á¦

<!DOCTYPE html public "-//w3c//dtd html 4//en">
<HTML>
<HEAD>
<TITLE>¾ð¾î ÂüÁ¶ - Javascript - ºñÇìºñ¾î(behavior) - userData ¿¹Á¦</TITLE>
<META http-equiv="Content-Type" content="text/html; charset=euc-kr">

<HEAD>
<STYLE>.sUserData {behavior:url(#default#userData);}</STYLE>
<SCRIPT>
function DoSave(){
  var persistObj=formName.persistID;
  if (!persistObj.value){
    alert('ÀÔ·ÂÇÏ°í ÁøÇàÇ϶ó.');
    return;
  }
  persistObj.setAttribute('persistStr',persistObj.value);
  persistObj.save('xmlObj');
  showA.innerHTML='persistObj.value=<FONT color=blue><B>'+persistObj.value+'</B></FONT>';
}
function DoLoad(){
  var persistObj=formName.persistID;
  persistObj.load('xmlObj');
  persistObj.value=persistObj.getAttribute('persistStr');
  showA.innerHTML='persistObj.value=<FONT color=blue><B>'+persistObj.value+'</B></FONT>';
}
</SCRIPT>
</HEAD>

<BODY>
<DIV style=width:500;padding:10>
<DIV style="border:solid 1 blue;background:fff;text-align:center;width:100%;margin:5">
<H4><SPAN class=titleblue><SPAN class=behavior>userData</SPAN> ¿¹Á¦</SPAN></H4>
</DIV>
<DIV style=text-align:right><SCRIPT>document.write(document.location)</SCRIPT></DIV><BR><BR>
<FORM id="formName">
<INPUT class="sUserData" type="text" id="persistID">
<INPUT type="button" value="Àбâ" onclick="DoLoad()">
<INPUT type="button" value="ÀúÀå" onclick="DoSave()">
</FORM><BR>
<DIV id=showA>°á°ú Ç¥½Ãâ</DIV><BR><BR>
<DIV>´Ù¸¥ ÆäÀÌÁö·Î °¬´Ù°¡ ´Ù½Ã¿Í¼­ Àаųª, »õ·Î°íħÇØ º¸¶ó.</DIV>
</DIV>

</BODY>
</HTML>

userData ºñÇìÀ̹ö ¿¹Á¦

ÀÔ·Â ¹®ÀÚ¿­À» ¹Ù²Ù°í Àо¶ó. Àü¿¡ ÀúÀåµÈ ³»¿ëÀÌ ÀÐÈù´Ù.

<HTML xmlns:myNamespace>
<HEAD>
<STYLE>myNamespace\:cacheObj {behavior:url(#default#userData);}</STYLE>
<SCRIPT>
function saveCache(){
  cachetag.setAttribute('attPersist',textObj.value);
  cachetag.save('cache');
  cachetag.value=cachetag.getAttribute('attPersist');
  str='<FONT color=red><B>save</B></FONT><BR>';
  showAttrib();
}
function loadCache(){
  cachetag.load('cache');
  cachetag.value=cachetag.getAttribute('attPersist');
  str='<FONT color=blue><B>load</B></FONT><BR>';
  showAttrib();
}
function showAttrib(){
  str+='cachetag.scopeName=<FONT color=blue>'+cachetag.scopeName+'</FONT><BR>';
  str+='cachetag.nodeName=<FONT color=blue>'+cachetag.nodeName+'</FONT><BR>';
  str+='cachetag.attributes[cachetag.attributes.length-1].name=<FONT color=blue>'+
    cachetag.attributes[cachetag.attributes.length-1].name+'</FONT><BR>';
  str+='cachetag.attributes[cachetag.attributes.length-1].value=<FONT color=blue>'+
    cachetag.attributes[cachetag.attributes.length-1].value+'</FONT>';
  showB.innerHTML=str;
}
</SCRIPT>
</HEAD>

<BODY>
<myNamespace:cacheObj id="cachetag"></myNamespace:cacheObj>
<INPUT type="button" value="Àбâ" onclick="loadCache()">
<INPUT type="button" value="ÀúÀå" onclick="saveCache()">
<INPUT type="text" id="textObj" value="ij½¬ ¹®ÀÚ¿­">
<DIV id=showB></DIV>
</BODY>
</HTML>