Program:
<html><head>
<!--HTML local storage, better than cookies.
With local storage, web applications can store data locally within the user's browser.
Local 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.
Local storage is per domain. All pages, from one domain, can store and access the same data.
HTML local storage provides two objects for storing data on the client:
window.localStorage - stores data with no expiration date
code.sessionStorage - stores data for one session (data is lost when the tab is closed)
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.
--!>
</head>
<body>
<br/>
<br/>
<br/>
<h1>
<center>
<script>
if (localStorage.pagecount)
{
localStorage.pagecount=Number(localStorage.pagecount) +1;
}
else
{
localStorage.pagecount=1;
}
document.write("Visits: " + localStorage.pagecount + " time(s).");
</script>
</h1>
</center>
</body>
</html>
No comments:
Post a Comment