ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

[±Ð¾Ç] (±Ð¾Ç²Ä27½g) ¨Ï¥Î Cookies ¤W½g

[±Ð¾Ç] (±Ð¾Ç²Ä27½g) ¨Ï¥Î Cookies ¤W½g

¤°»ò¬O¡uCookies¡v¡HCookies´N¬O¦Yªº¤p»æ°®£«¡I¤£¬O°Õ¡ICookies¬Oºô¯¸¡]ºô­¶¡^¦b¨Ï¥ÎªÌºÝ(client)¡A¤]´N¬O§AªºµwºÐ¤¤©ÒÀx¦sªº¤@¤p¬q¸ê°T¡I¥¦¥i¥H°O¿ý§AÂsÄýºô¯¸®Éªº¤@¨Ç¸ê°T¡A¨Ïºô¯¸ÅÜÁo©ú¡A·í§A¦A«×¥úÁ{ºô¯¸®É¡A©Î³\§A·|µo²{ºô¯¸³ºµMª¾¹D§A¬O½Ö¡B¥s¤°»ò¦W¦r¡B¦í¦b­þ¸Ì¡K¡I²{¦b¡A«Ü¦hªººô¯¸³£¤w¸g§Q¥Î³oºØCookies§Þ³N¨Ó°O¦í³X«ÈªºÂsÄý²ßºD¡C

Cookies¬O¦b§Ú­Ì¨Ï¥ÎÂsÄý¾¹¶}©l¾C¹Cºô¸ô®É¡A³Q«Ø¥ß©Î¨ú¥Î¡A·í§AÃö³¬ÂsÄý¾¹¡Aµ²§ôÂsÄý®É¡A¥¦¨ÌµM¦s¬¡¦b§Aªº¹q¸£¸Ì¡A³o¨ÇCookiesÀɮצb­þ¸Ì¡H¥HIE¬°¨Ò¡A¥¦­Ì´N¦b¡y\WINDOWS\Temporary Internet Files¡z¥Ø¿ý¸Ì¡G


¦b¥»½g¤¤±N¬°¤j®a¤¶²Ð¦p¦óÀx¦sCookies¡B¦p¦ó¨ú¥ÎCookies¸Ìªº¸ê°T¤Î¦p¦ó§R°£Cookies¡C

´£¥Ü¡I¡I
¤@­ÓCookieÀɮׯàÀx¦sªñ300­ÓCookies¡A¦Ó¨C­ÓCookies¬ù¥iÀx¦s4000­Ó¦ì¤¸²Õªº¸ê®Æ¡C


Àx¦sCookies
Cookiesªº¾Þ§@¬O¥²¶·³z¹L¡uª«¥ó¡v¨Ó³B²zªº¡A¾a­þ¤@­Óª«¥ó¡H·íµM¬O¾adocumentÅo¡C
  1. document.cookie
½Æ»s¥N½X
¼g¤J¨ìCookieÀɮ׸̪ºCookies¸ê°T®æ¦¡¦p¤U¡G
Cookie¸ê°T®æ¦¡
  1. name= valie;[expires=data;[path=path;[domain=domain[secure;]]]]¡¨
½Æ»s¥N½X
  1. ¦WºÙ=¸ê®Æ; ¨ì´Á®É¶¡=¤é´Á;¸ô®|=Àx¦s¸ô®|; ºô§}=»s§@Cookiesªººô°ì
½Æ»s¥N½X
¦b¨Ï¥ÎCookies®É¡A¦WºÙ¡]name¡^°Ñ¼Æ¤@©w­n¦³¡A¦Ü©ó¼g¤Jªº¸ê®Æ´N¤£¤@©w¬O¥²¶·ªº¡A¦ý¬O¡A§Ú­Ì­Y¥u«ü©w¦WºÙ¡]name¡^°Ñ¼Æ¡A¦Ó¨S¦³¦b«ü©w¨ä¥Lªº°Ñ¼Æ¡]¼g¤Jªº¸ê®Æ¡^¡A«hCookies±N¥u¦s¦b©óÂsÄý¾¹¤§¤¤¡A¨Ã¨S¦³³Q¼g¤JÂsÄýªÌªºµwºÐ¸Ì¡A¤]´N¬O»¡¡A·íÂsÄý¾¹¥²Ãö³¬®É¡A³o­ÓCookies´N·Ï®ø¶³´²¤F¡I

¤U­±³o­Óµ{¦¡¨Ò¤l±N¥i¥H¦bºô­¶¸ü¤J®É°O¿ýÂsÄýºô­¶ªº¶}©l¤é´Á»P®É¶¡¡G
  1. <SCRIPT LANUAGE=¡¨JavaScript¡¨>
  2. begindate = new Date()
  3. document.cookie = ¡§webtime=¡¨+excape(begindate)
  4. </SCRIPT>
½Æ»s¥N½X
·í§Ú­Ì«ü©wµ¹Cookies¸ê®Æ®É¡A³o­Ó¸ê®Æ¤º¤£¯à§t¦³¯S®í¦r¤¸©Î²Å¸¹¡A¨Ò¦p¡G³r¸¹©Î¤À¸¹¡A¬Æ¦Ü¬O¡uªÅ¥Õ¡]space¡^¡v¡A¦pªG¸ê®Æ¤¤§t¦³¯S®í¦r¤¸©Î²Å¸¹¡A´N¥²¶·¨Ï¥Îescape()¨ç¦¡¨Ó³B²z³o¨Ç¯S®í¦r¤¸©Î²Å¸¹¡]¤¤¤å¦r¨ä¹ê¤]¬O¡^¡A¦p¤W¨Ò¡A§Ú­Ì´N±N¤é´Á»P®É¶¡¸ê®Æ¥Hescape()¨ç¦¡¨Ó¹w¥ý³B²z¡C


¹ê§@¾Ç²ß¡G
»s§@¤@­ÓJavaScriptµ{¦¡¡A¨Ï¥ÎCookies°O¿ýÂsÄýªÌªº©m¦W¡C
  1. <HTML>
  2. <HEAD>
  3. <TITLE>Àx¦sCookies</TITLE>
  4. </HEAD>
  5. <BODY>
  6. <SCRIPT Language="JavaScript">
  7. name=¡¨user¡¨
  8. //¥X²{¸ß°Ýµøµ¡
  9. username=prompt("½Ð°Ý±zªº©m¦W¡H","µL¦W¤ó")

  10. //¦pªG¦³¶ñ¼g©m¦W
  11. if (username)
  12. {
  13. //¼g¤JCookiesªº¸ê®Æ¬°name=©m¦W
  14. document.cookie=name + "=" + escape(username)
  15. document.write("±zªº©m¦W¬O:"+username)
  16. }

  17. //¦pªG¨S¦³¶ñ¼g©m¦W
  18. else
  19. {
  20. //¼g¤JCookiesªº¸ê®Æ¬°name=¯«¯µ¤H
  21. document.cookie=name + "=" + escape("¯«¯µ¤H")
  22. document.write("±zªº©m¦W¬O:¯«¯µ¤H")
  23. }
  24. </SCRIPT>
  25. </BODY>
  26. </HTML>
½Æ»s¥N½X

  • ·íºô­¶¸ü¤J®É±N¥X²{¤@­Ó¿é¤J¹ï¸Üµøµ¡¡]µ{¦¡½X²Ä8¦æ¡^¡G

  • ¦b¼g¤JCookies¤§«e¡A¥ýÀËÅç¤@¤U¿é¤J¹ï¸Üµøµ¡¬O§_¦³¦^¶Ç¸ê®Æ¡A¦pªG¦³¡A«h±N¦^¶Ç¸ê®Æ¼g¤JCookies¡]µ{¦¡½X²Ä14¦æ¡^¡A¦pªG¨S¦³¡A«h¹w³]¼g¤JCookiesªº¸ê®Æ­È¬O¡u¯«¯µ¤H¡v¡]µ{¦¡½X²Ä22¦æ¡^¡I

¤ß¦w¡A¥­¦w   
µoªí¥ô¦óµL·N¸qªº·PÁ©ÎÄé¤ô¤å³¹¤@«ß¬å,¬Ã±¤±b¸¹,½Ð¸Ô¾\ª©³W!!

³]©wCookiesªº¨Ï¥Î´Á­­
¤§«e§Ú­Ì»¡¹L¡G­Y¥u«ü©w¦WºÙ¡]name¡^°Ñ¼Æ¡A¦Ó¨S¦³¦b«ü©w¨ä¥Lªº°Ñ¼Æ¡]¼g¤Jªº¸ê®Æ¡^¡A«hCookies±N¥u¦s¦b©óÂsÄý¾¹¤§¤¤¡C¦p¦óÃÒ©ú¡HÁöµM§Ú­Ì±NÂsÄý¾¹Ãö³¬¡A¦]¬°ÂsÄý¾¹¦³³]©w¡u§Ö¨ú°O¾Ð¡v¡A©Ò¥H§Ú­Ì¤´µM¬Ý±o¨ì´¿¸gÂsÄýªººô­¶¡A¦p¤U¹Ï¡A¥i¬O´N¥u¦³ºô­¶¦Ó¤w¡A¨Ã¨S¦³CookiesÀɮסG


´£¥Ü¡I¡I
ÂsÄý¾¹ªº¡u§Ö¨ú°O¾Ð¡v¥u¦³¦b¡u°õ¦æÂsÄý¡v®É¤~·|¥Í®Ä¡A­Y§A¨Ï¥Î¡u¶}±ÒÂÂÀÉ¡vªº¤è¦¡Æ[¬Ýºô­¶(ÀÉ®×=>¶}±ÒÂÂÀÉ)¡A«h¡u§Ö¨ú°O¾Ð¡v¬O¨S¦³§@¥Îªº¡C

¦]¦¹¡A§A­nÅýCookiesªº¸ê°T¯u¥¿ªº¿W¥ß°O¿ý¦bCookieÀɮפ¤¡A°£¤F¦WºÙ¡]name¡^°Ñ¼Æ¥~¡A¥²¶·¦A¥[¤W¨ä¥Lªº°Ñ¼Æ¡I°£¦WºÙ°Ñ¼Æ¤§¥~¡A³Ì±`¥[¤JCookies¤¤ªº°Ñ¼Æ´N¬O¡uexpires¡]¨ì´Á¤é¡^¡v¡C

°²³]¡A§Ú­Ì§Æ±æCookiesªº¨ì´Á¤é¬°ÂsÄýªÌ²Ä¤@¦¸°ÑÆ[ºô­¶¤§«áªº¤@¦~®É¡A«h§Ú­Ì¥i¥H³]©w¤@­Ó¨ì´Á¤éªº¤é´Áª«¥ó¡A¦p¤U¡G
  1. begindate = new Date()
  2. enddate =new Date()
  3. enddate.setDate = beginDate.getDate + 365
½Æ»s¥N½X
¤W¨Ò¤¤¡A§Ú­Ì³]©w¤F¨â­Ó¤é´Áª«¥ó¡Abegindate¤é´Áª«¥ó¥Î¨Ó±oª¾ÂsÄýªÌ°ÑÆ[ºô­¶°ÑÆ[ºô­¶ªº¤é´Á¡A¦Óenddate¤é´Áª«¥óªº¤é´Á«h¬°Cookiesªº¨ì´Á¤é¡A§Ú­Ì§Q¥ÎgetDate()¤èªk¡A¥ý¨ú±obegindate¤é´Áª«¥óªº¤é´Á¡A¥[¤W365¤Ñ«á¡A¦A¥HsetDate()¤èªk±NCookiesªº¤é´Á³]©wµ¹enddate¤é´Áª«¥ó¡C

·í§Ú­Ì¥H¡uexpires¡]¨ì´Á¤é¡^¡v°Ñ¼Æ¨Ó³]©wCookiesªº¨ì´Á¤é®É¡A¨ì´Á¤éªº®æ¦¡¥²¶·¨Ï¥ÎGMT¡]®æªL«Âªv®É¶¡¡^ªº®æ¦¡¨Óªí¥Ü¡G
  1. week, day mon year hh:mm:ss GMT
½Æ»s¥N½X
¨Ò¦p¡G
  1. Tue, 15 Dec 2000 20:25:30 GMT
½Æ»s¥N½X
­Y­n±N¤é´Á®æ¦¡Âà´«¦¨GMT®æ¦¡ªº¦r¦ê¡A«h§Ú­Ì¥i¥H¨Ï¥ÎDate()¤é´Á®É¶¡ª«¥óªº toGMTString()¤èªk¡C

¹ê§@¾Ç²ß¡G
»s§@¤@­ÓJavaScriptµ{¦¡¡A¨Ï¥ÎCookies°O¿ýÂsÄýªÌªº©m¦W¡A¨Ã«ü©wCookiesªº¨ì´Á¤é¡C
  1. <HTML>
  2. <HEAD>
  3. <TITLE>Cookies¨Ï¥Î´Á­­</TITLE>
  4. </HEAD>
  5. <BODY>
  6. <SCRIPT Language="JavaScript">
  7. //«Ø¥ß¤é´Á®É¶¡ª«¥ó
  8. begindate = new Date()
  9. enddate =new Date()
  10. //³]©wCookies¨ì´Á¤é
  11. enddate.setDate ( begindate.getDate() + 365)
  12. name=¡¨username¡¨
  13. //¥X²{¸ß°Ýµøµ¡
  14. username=prompt("½Ð°Ý±zªº©m¦W¡H","µL¦W¤ó")

  15. //¦pªG¦³¶ñ¼g©m¦W
  16. if (username)
  17. {
  18. //¼g¤JCookiesªº¸ê®Æ¬°©m¦W¤Î¨ì´Á¤é
  19. document.cookie=name + "=" + escape(username) + "; expires="+ enddate.toGMTstring()
  20. document.write("±zªº©m¦W¬O:"+username)
  21. }

  22. //¦pªG¨S¦³¶ñ¼g©m¦W
  23. else
  24. {
  25. //¼g¤JCookiesªº¸ê®Æ¬°¯«¯µ¤H¤ÎCookies¨ì´Á¤é
  26. document.cookie=name + "=" + escape("¯«¯µ¤H") + "; expires="+ enddate.toGMTString()
  27. document.write("±zªº©m¦W¬O:¯«¯µ¤H")
  28. }
  29. </SCRIPT>
  30. </BODY>
  31. </HTML>
½Æ»s¥N½X
ºô­¶°õ¦æÂsÄý«á¡A¡y\WINDOWS\Temporary Internet Files¡z¥Ø¿ý¤¤ªGµM¥X²{¤F¿W¥ßªºCookieÀɮסI


´£¥Ü¡I¡I
©Ò¦³ªºCookieÀɮ׳£¦³¤@­Ó¹w³]ªººô°ì»P¸ô®|¡A¥u¦³«Ø¥ß¦¹Cookieªººô°ì»P¸ô®|¤~¯à¦s¨ú³o­ÓCookieÀɮסC
¤ß¦w¡A¥­¦w   
µoªí¥ô¦óµL·N¸qªº·PÁ©ÎÄé¤ô¤å³¹¤@«ß¬å,¬Ã±¤±b¸¹,½Ð¸Ô¾\ª©³W!!

TOP

        ÀR«ä¦Û¦b : §g¤l¥ß«í§Ó¡A¤p¤H«í¥ß§Ó¡C
ªð¦^¦Cªí ¤W¤@¥DÃD