Содержание
- 2. WEB STORAGE Web Storage introduces storage in the browser and includes two objects sessionStorage and localStorage:
- 3. WEB STORAGE The sessionStorage and localStorage objects represent data as a set of key: value pairs.
- 4. WEB STORAGE localStorage.setItem("user", "Tom"); localStorage.setItem("role", "guest"); console.log(localStorage.getItem("user")); // "Tom" console.log(localStorage.getItem("role")); // "guest" console.log(localStorage.length); // 2 console.log(localStorage.key(0));
- 5. WEB STORAGE Please note, that both key and value must be strings only, this lay on
- 6. WEB STORAGE To store complex data, such as objects or arrays, you need to use serializations
- 7. WEB STORAGE When the data in localStorage or sessionStorage is updated, a "storage" event is fired
- 8. WEB STORAGE To demonstrate the work of the "storage" event, create an index.html file the following
- 9. WEB STORAGE Open index.html in two tabs of one browser and call several methods from the
- 11. Скачать презентацию