HTML Web Storage API

HTML is the standard markup language for Web pages.
With HTML you can create your own Website.
HTML is easy to learn - You will enjoy it!
Post Reply
Guest

HTML Web Storage API

Post by Guest »

HTML Web Storage API


HTML web storage; better than cookies.

What is HTML Web Storage?
With web storage, web applications can store data locally within the user's browser.
Before HTML5, application data had to be stored in cookies, included in
every server request. Web storage is more secure, and large amounts of data
can be stored locally, without affecting website performance.
Unlike cookies,
the storage limit is far larger (at least 5MB) and information is never
transferred to the server.
Web storage is per origin (per domain and protocol). All pages, from one
origin, can store and access the same data.

Browser Support
The numbers in the table specify the first browser version that fully supports
Web Storage.


API







Web Storage
4.0
8.0
3.5
4.0
11.5



HTML Web Storage Objects
HTML web storage provides two objects for storing data on the client:

window.localStorage - stores data with no expiration date
window.sessionStorage - stores data for one session (data is lost when the browser tab is closed)

Before using web storage, check browser support for localStorage and sessionStorage:

if (typeof(Storage) !== "undefined") {
  // Code for localStorage/sessionStorage.
}
else {
  // Sorry! No Web Storage support..
}







The localStorage Object
The localStorage object stores the data with no expiration date. The data
will not be deleted when the browser is closed, and will be available the next day, week, or year.

Example

// StorelocalStorage.setItem("lastname", "Smith");// Retrieve
document.getElementById("result").innerHTML = localStorage.getItem("lastname");

Try it Yourself »

Example explained:

Create a localStorage name/value pair with name="lastname" and value="Smith"
Retrieve the value of "lastname" and insert it into the element with id="result"

The example above could also be written like this:

// StorelocalStorage.lastname = "Smith";// Retrieve
document.getElementById("result").innerHTML = localStorage.lastname;
The syntax for removing the "lastname" localStorage item is as follows:

localStorage.removeItem("lastname");
Note: Name/value pairs are always stored as strings.
Remember to convert them to another format when needed!
The following example counts the number of times a user has clicked a button.
In this code the value string is converted to a number to be able to increase the counter:

Example

if (localStorage.clickcount) {  localStorage.clickcount = Number(localStorage.clickcount) + 1;
} else {  localStorage.clickcount = 1;}
document.getElementById("result").innerHTML = "You have clicked the button " +
localStorage.clickcount + " time(s).";
Try it Yourself »


The sessionStorage Object
The sessionStorage object is equal to the localStorage object, except
that it stores the data for only one session. The data is deleted when the user closes the
specific browser tab.
The following example counts the number of times a user has clicked a button, in the current session:

Example

if (sessionStorage.clickcount) {  sessionStorage.clickcount = Number(sessionStorage.clickcount) + 1;}
else {  sessionStorage.clickcount = 1;}
document.getElementById("result").innerHTML = "You have clicked the button " +
sessionStorage.clickcount + " time(s) in this session.";

Try it Yourself »














+1

Reference: https://www.w3schools.com/html/html5_webstorage.asp
alexseen
Posts: 0
Joined: Fri Dec 27, 2024 6:00 pm

Re: <t>HTML Web Storage API</t>

Post by alexseen »

Ich stöbere manchmal nach neuen Spieleseiten, und diesmal bin ich bei https://win-aura.ch hängen geblieben. Die Seite ist nicht überladen und die Schweiz-Boni stehen ordentlich da. Mir gefällt besonders, dass die Menüstruktur logisch ist und man sich nicht sofort verirrt. Die Spiele starten ohne Verzögerung, was mir wichtig ist. Dadurch kann ich entspannt spielen, auch wenn ich nur paar Minuten Freizeit habe.
Wilsony
Posts: 0
Joined: Sat Dec 06, 2025 1:22 am

Re: <t>HTML Web Storage API</t>

Post by Wilsony »

Winter might be months away (or perhaps it’s right outside your window), but the urge to slide down a mountain at breakneck speeds is a year-round feeling for many of us. While we can’t always book a trip to the Alps or the Rockies, the world of browser games offers a surprisingly fun alternative. Lately, I’ve been hooked on a title that perfectly captures that rush of cold air and adrenaline without requiring a lift pass: a little gem called Snow Rider 3D.
If you’re looking for a quick gaming fix during a lunch break or just want to zone out and test your reflexes, here is a look at how to get the most out of this winter sports experience.
The Basics: How to Play
The beauty of arcade-style browser games lies in their simplicity, and this one is no exception. The premise is straightforward: you are on a sleigh, and gravity is doing all the heavy lifting. Your goal is to travel as far as possible down an endless, procedurally generated slope while dodging obstacles and collecting gifts.
Unlike complex simulators that require you to memorize ten different button combinations just to stand up, the controls here are intuitive. You typically use the arrow keys or A and D keys to steer left and right. The Up arrow (or Spacebar) usually initiates a jump. That sounds easy, right?
The challenge comes from the physics and the environment. As you gain momentum, the speed increases significantly. You aren’t just avoiding simple rocks; you have to navigate around massive snowmen, rolling snowballs, and gigantic trees. The game forces you to make split-second decisions. Do you risk a tight squeeze between two boulders to grab a gift, or do you play it safe and steer wide?
Tips for Staying on the Sleigh
I’ve spent more time than I’d like to admit crashing into virtual pine trees. Through trial and error, I’ve picked up a few strategies that help extend the run:
Look Ahead, Not Down: It is tempting to stare directly at your sleigh, but you need to keep your eyes on the horizon. By spotting obstacles before they are right in front of you, you can plan a smoother path. This is crucial when the speed picks up.
Master the Jump: Jumping isn’t just for show; it’s a survival mechanic. Sometimes the gap between obstacles is too small to steer through. A well-timed jump can clear low rocks or logs that would otherwise end your run. However, be careful—you have zero steering control while in the air.
Collect Gifts Wisely: The gifts scattered on the track act as currency. You use them to unlock different sleighs. While it’s fun to grab every gift you see, don’t die for a single box. Prioritize survival over loot.
New Sleighs Matter: As you unlock new rides, you might notice subtle differences. Some feel heavier and more stable, while others feel twitchier. Find the one that matches your reaction style.
Why It’s Worth a Try
We often get caught up in massive, 100-hour RPGs or intense competitive shooters. Sometimes, it is refreshing to play something that demands nothing more than pure reflex and focus. Snow Rider 3D hits that sweet spot of "easy to learn, hard to master." It provides that satisfying "just one more run" feeling that keeps you glued to the screen for twenty minutes when you only intended to play for five.
Conclusion
Whether you are a seasoned snowboarder missing the powder or just a gamer looking for a fun way to kill time, virtual sledding offers a great escape. The graphics are crisp, the sense of speed is genuine, and the satisfaction of beating your high score is undeniable. So, warm up your fingers, keep your eyes on the track, and see how far down the mountain you can go before wiping out. Happy sledding
Post Reply