80 likes | 242 Views
HTML 5 STORAGE. CLINT SIDE STORAGE. SAFA SADEQ. WHAT IS CLIENT SIDE STORAGE ???. It’s small storage contains the data of any website in the client's computer . It’s save it in ‘key’ = ‘value’ method . It’s useful in client/server side web application . Most popular CSS is the COOKIE .
E N D
HTML 5 STORAGE CLINT SIDE STORAGE SAFA SADEQ
WHAT IS CLIENT SIDE STORAGE ??? • It’s small storage contains the data of any website in the client's computer . • It’s save it in ‘key’ = ‘value’ method . • It’s useful in client/server side web application . • Most popular CSS is the COOKIE . • COOKIE is save small amounts of data on the client computer as array of key /value . • But it’s have potentially disadvantages .
three potentially dealbreaking downsides on cookie • Cookies are included with every HTTP request, thereby slowing down your web application by needlessly transmitting the same data over and over . • Cookies are included with every HTTP request, thereby sending data unencrypted over the internet . • Cookies are limited to about 4 KB of data — enough to slow down your application .
What we really want ? • a lot of storage space . • on the client. • that persists beyond a page refresh . • and isn’t transmitted to the server . When I can found that ?!! Html5 Produce local storage that have all what we need .
So what is HTML5 storage ??? • Simply put, it’s a way for web pages to store named key/value pairs locally, within the client web browser. Like cookies, this data persists even after you navigate away from the web site, close your browser tab, exit your browser, or what have you. Unlike cookies, this data is never transmitted to the remote web server (unless you go out of your way to send it manually) • From your JavaScript code, you’ll access HTML5 Storage through the localStorage object on the global window object. • Storage space of around 5MB depending upon user agent
Who I know if my browser support that? • All these browsers support HTML5 storage : IE 8.0 , FIREFOX 3.5 ,SAFARI 4.0 ,CHROME 4.0 , OPERA 10.5 and above .
Important thing !!!! You can access to this storage from JavaScript code only . Through the two objects: localStorage & sessionStorage
sessionStoragevslocalStorage • When I using localStorage in previous example , I save the counter value when I close my browser window , and in any time I return to this page the counter is increment . • But when I use sessionStorage , I lose the counter value when I close my browser window , and that is useful in many client web application .