သိုလှောင်မှု API
Storage Object
Web Storage API ၏ Storage object သည် သီးခြား domain တစ်ခုအတွက် session storage သို့မဟုတ် local storage သို့ ဝင်ရောက်ခွင့် ပေးပါသည်။ ၎င်းသည် သင့်အား သိမ်းဆည်းထားသည့် ဒေတာပစ္စည်းများကို ဖတ်ရန်၊ ထည့်ရန်၊ ပြင်ဆင်ရန်နှင့် ဖျက်ရန် ခွင့်ပြုသည်။
Storage Object Properties နှင့် Methods
Property/Method | Description |
---|---|
key(n) | Returns the name of the nth key in the storage |
length | Returns the number of data items stored in the Storage object |
getItem(keyname) | Returns the value of the specified key name |
setItem(keyname, value) | Adds that key to the storage, or update that key's value if it already exists |
removeItem(keyname) | Removes that key from the storage |
clear() | Empty all key out of the storage |
ဝဘ်သိုလှောင်မှု API အတွက် ဆက်စပ်စာမျက်နှာများ
Property | Description |
---|---|
window.localStorage | Allows to save key/value pairs in a web browser. Stores the data with no expiration date |
window.sessionStorage | Allows to save key/value pairs in a web browser. Stores the data for one session |
Cookies နှင့် Local Storage
ကွတ်ကီးများသည် သုံးစွဲသူ-ဆာဗာ (ဘရောက်ဆာ-ဆာဗာ) အပလီကေးရှင်းများအတွက် ဖြစ်သည်။
Local storage သည် client (browser) အပလီကေးရှင်းများအတွက်ဖြစ်သည်။
ကွတ်ကီးများသည် ဝဘ်ဆိုက်များနှင့် ဆက်စပ်နေသည်။ ဒေတာသည် သုံးစွဲသူအသုံးပြုရန်အတွက်ဖြစ်ပါက HTTP ခေါင်းစီးတိုင်းရှိ ကွတ်ကီးများ ပေးပို့ခြင်းသည် bandwith ၏ခါးဖြစ်သည်။
အချို့သောအသုံးပြုသူများသည် ၎င်းတို့၏ဘရောက်ဆာများတွင် စည်းကမ်းအတိုင်း ကွတ်ကီးများကို ပိတ်ထားသည်။
ကွတ်ကီးတစ်ခုတွင် အရွယ်အစားကန့်သတ်ချက် 4 Kilobytes ရှိသည်။ Local Storage တွင် ဒိုမိန်းတစ်ခုလျှင် 5 Megabytes ကန့်သတ်ချက်ရှိသည်။
ကွတ်ကီးတစ်ခုတွင် သက်တမ်းကုန်ဆုံးရက်ရှိသည်။ Local Storage မပါဘူး။
Browser ပံ့ပိုးမှု
Storage API
ဘရောက်ဆာအားလုံးတွင် ထောက်ခံသည်-
Chrome | IE | Edge | Firefox | Safari | Opera |
Yes | 8-11 | Yes | Yes | Yes | Yes |