Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the basic syntax for HTML5 local storage globalStorage

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces the relevant knowledge of "what is the basic syntax of HTML5 local storage globalStorage". The editor shows you the operation process through an actual case. The operation method is simple, fast and practical. I hope this article "what is the basic syntax of HTML5 local storage globalStorage" can help you solve the problem.

GlobalStorage

This is also proposed in html5. After the browser is closed, the information stored in globalStorage can still be retained. Like localStorage, the information stored on any page in the domain can be shared by all pages.

Basic grammar

GlobalStorage ['developer.mozilla.org']-all subdomains under developer.mozilla.org can use this namespace to store objects for reading and writing.

GlobalStorage ['mozilla.org']-all web pages under the mozilla.org domain name can be read and written through this namespace to store objects.

GlobalStorage ['org']-all web pages under the. Org domain name can be read and written through this namespace to store objects.

GlobalStorage [']-any web page under any domain name can use this namespace to store objects for reading and writing

Method attribute

SetItem (key, value)-sets or resets the key value.

GetItem (key)-- gets the key value.

RemoveItem (key)-deletes the key value.

Set the key value: window.globalStorage ["planabc.net"] .key = value

Get the key value: value = window.globalStorage ["planabc.net"] .key

Other

The expiration time is similar to that of localStorage, and some other features are similar to localStorage.

Currently, Firefox only supports globalStorage storage in the current domain, and using a common domain will result in a similar error "Security error" code: "1000".

This is the end of the introduction to "what is the basic syntax of HTML5 local storage globalStorage". Thank you for reading. If you want to know more about the industry, you can follow the industry information channel. The editor will update different knowledge points for you every day.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report