like us on fb

keep updating with us..


get updates with our fb page ... we will provide 3g hacks,free net tricks,free balance and many more..!! Like us on FACEBOOK AND Download our official android app


LocalStorage in JavaScript: A complete guide

Leave a Comment

 In this tutorial, we’ll show you how to use the localStorage mechanism and Window.localStorage property and review the basics of web storage in JavaScript.

We’ll cover the following in detail:

What is the Web Storage API?

The Web Storage API is a set of mechanisms that enable browsers to store key-value pairs. It is designed to be much more intuitive than using cookies.

The key-value pairs represent storage objects, which are similar to objects except they remain intact during page loads, and are always strings. You can access these values like an object or using the getItem() method (more on that later).

What is the difference between sessionStorage and localStorage?

The Web Storage API consists of two mechanisms: sessionStorage and localStorage. Both sessionStorage and localStorage maintain a separate storage area for each available origin for the duration of the page session.

The main difference between sessionStorage and localStorage is that sessionStorage only maintains a storage area while the browser is open (including when the page reloads or restores) while localStorage continues to store data after the browser is closed. In other words, whereas data stored in sessionStorage is cleared when the page is closed, data stored in localStorage does not expire.

In this tutorial, we’ll focus on how to use localStorage in JavaScript.

What is localStorage in JavaScript?

localStorage is a property that allows JavaScript sites and apps to save key-value pairs in a web browser with no expiration date. This means the data stored in the browser will persist even after the browser window is closed.

Where is localStorage stored?

In Google Chrome, web storage data is saved in an SQLite file in a subfolder in the user’s profile. The subfolder is located at \AppData\Local\Google\Chrome\User Data\Default\Local Storage on Windows machines and ~/Library/Application Support/Google/Chrome/Default/Local Storage on macOS

Firefox saves storage objects in an SQLite file called webappsstore.sqlite, which is also located in the user’s profile folder.

What is Window.localStorage?

The localStorage mechanism is available via the Window.localStorage property. Window.localStorage is part of the Window interface in JavaScript, which represents a window containing a DOM document.

The Window interface features a wide range of functions, constructors, objects, and namespaces. Window.localStorage is a read-only property that returns a reference to the local storage object used to store data that is only accessible to the origin that created it.

How does localStorage work?

To use localStorage in your web applications, there are five methods to choose from:

  1. setItem(): Add key and value to localStorage
  2. getItem(): This is how you get items from localStorage
  3. removeItem(): Remove an item by key from localStorage
  4. clear(): Clear all localStorage
  5. key(): Passed a number to retrieve the key of a localStorage

setItem(): How to store values in localStorage

Just as the name implies, this method allows you to store values in the localStorage object.

It takes two parameters: a key and a value. The key can be referenced later to fetch the value attached to it.

window.localStorage.setItem('name', 'Obaseki Nosa');

Where name is the key and Obaseki Nosa is the value. Also note that localStorage can only store strings.

To store arrays or objects, you would have to convert them to strings.

To do this, we use the JSON.stringify() method before passing to setItem().

const person = {
    name: "Obaseki Nosa",
    location: "Lagos",
}

window.localStorage.setItem('user', JSON.stringify(person));

getItem(): How to get items from localStorage

To get items from localStorage, use the getItem() method. getItem() allows you to access the data stored in the browser’s localStorage object.

getItem() accepts only one parameter, which is the key, and returns the value as a string.

To retrieve a user key:

window.localStorage.getItem('user');

This returns a string with value as:

“{“name”:”Obaseki Nosa”,”location”:”Lagos”}”

To use this value, you would have to convert it back to an object.

To do this, we make use of the JSON.parse() method, which converts a JSON string into a JavaScript object.

JSON.parse(window.localStorage.getItem('user'));

removeItem(): How to delete localStorage sessions

To delete local storage sessions, use the removeItem() method.

When passed a key name, the removeItem() method removes that key from the storage if it exists. If there is no item associated with the given key, this method will do nothing.

window.localStorage.removeItem('name');

clear(): How to delete all items in localStorage

Use the clear() method to delete all items in localStorage.

This method, when invoked, clears the entire storage of all records for that domain. It does not receive any parameters.

window.localStorage.clear();

key(): How to get the name of a key in localStorage

The key() method comes in handy in situations where you need to loop through keys and allows you to pass a number or index to localStorage to retrieve the name of the key.

var KeyName = window.localStorage.key(index);

localStorage browser support

localStorage as a type of web storage is an HTML5 specification. It is supported by major browsers including IE8. To be sure the browser supports localStorage, you can check using the following snippet:

if (typeof(Storage) !== "undefined") {
    // Code for localStorage
    } else {
    // No web storage Support.
}

localStorage limitations

As easy as it is to use localStorage, it is also easy to misuse it. The following are limitations, and also ways to NOT use localStorage:

  • Do not store sensitive user information in localStorage
  • It is not a substitute for a server based database as information is only stored on the browser
  • localStorage is limited to 5MB across all major browsers
  • localStorage is quite insecure as it has no form of data protection and can be accessed by any code on your web page
  • localStorage is synchronous, meaning each operation called would only execute one after the other

With these, we have been armed with the power of localStorage in our web applications.

THANKS FOR READING THIS ARTICLE. 

HOPE THIS WOULD HELP YOU IN SOME WAY...

source : LegRocket


DOWNLOAD AVAST ANTIVIRUS 2021 FREE TILL 2038 (WITH PRODUCT KEY)

Leave a Comment

 

Avast Free Antivirus offers an antivirus and anti-malware protection, along with features you’re most likely to need, but would rather not think about – like one-click system checks, and unwanted toolbar removal. Avast Free Antivirus scans for security and performance issues and tells you how to fix things instantly. It protects you in real-time by analyzing unknown files before they get to you. So relax: With Avast, you’re running the most trusted antivirus out there.

This edition is FREE OF CHARGE for non-commercial & home use.

What’s new in version 18.6.3983.0:

  • Do Not Disturb Mode replaces Game Mode and adds support for non-game apps too
  • Edge extension replaces the Internet Explorer one
  • SecureLine VPN component won’t be part of AV. User will be offered to install standalone VPN client independent from AV (staged release not for all users now)
  • Support for scanning TLS 1.3 traffic via Web Shield (Chrome, Firefox)
  • Automatic redirect to search page if domain isn’t found

Fixed:

  • Firewall notification not displayed when network changed
  • Detection dialog not displayed for Web Shield when set to Ask
  • Wrong reporting of Wi-Fi Inspector scan progress percent
  • Site blocking works again
  • Rescue disc
  • Reporting of AV and Firewall state to Windows Security Center
  • Explorer scan result not added to Notification Center
  • Removed Enable offline mode option in free version tray icon

Download:
Download Avast! Free Antivirus |

Download :

Download Avast License file

HOW TO INSTALL:—

==> OPEN “AVAST” INTERFACE

==> CLICK MENU

==> CLICK ON “ENTR ACTIVATION CODE

==> SELECT LICENSE FILE

Here you are done … 🙂

Thanks Guys !!! If you would have any issue must comment .

After downloading please Leave us a comment…

Like Us on Facebook :

C PROGAMMING QUESTIONS --> FUNCTION

Leave a Comment

**********************QUESTION ********************************


 Consider all integers in the given interval [20, 70]. Write a function to return the

number of even integers that are divisible by a random number k, where 1 £ k £ 20. Here an

integer x is divisible by k is defined as: x o 0 (mod k).


***************************SOLUTION*****************************


#include<stdio.h> #include<stdlib.h> #include<time.h> int even(int); int main(){ int n=0; printf("\nnumber of even integers=%d\n",even(n)); return 0; } int even(x){ int k,i,n=0; srand(time(0)); k=rand()%20+1; printf("random number=%d\n",k); for(int x=10;x<=70;x++){ if(x%2==0&&x%k==0){ printf("%d\t",x); n++; } } return n; }



        THANK YOU !!!!

THIS CODE IS WRITTEN BY HACKINGALLTOU.BLOGSPOT.COM

                LIKE US ON FB  

Loot] Earn Free Paytm Cash By Playing Contests

Leave a Comment

Hello Guys! We are back with an interesting loot offer from which you can earn unlimited Free paytm cash by just participating in easy contests.

In these lock down days you can play games , participate in online quiz and win lots of cash so let's start .

Yovo App is just like a Vigo, TikTok or many Video Making App. Yovo Super Kalakaar. Mobile talent championship is here where you can earn Free PayTM Cash.

Steps To Win Paytm Cash :

  • First of All Download Yovo App From Given Link Below :
             :- Download Now Yovo App 
  • Now open the App and allow the permissions.
  • You will Get 100 Yovo Coins instantly.
  • Tap on Profile Button from Bottom Corner.
  • Enter your mobile number and verify by entering OTP.
  • Now Tap on “+” Icon from upper right Corner and Tap on Use Refer Code.
  • Now Enter this Refer code to get 250 Coins instantly [Important]

Refer Code : ZPPGNA

  • You will Get 250 Coins instantly in your Account. Tap on Done.
  • Now change your Username and Add Profile Photo and you will get total 500 Coins in your Account.
  • You can get free 100 Coins every 3 hours by opening the app.
  • Now Tap on ‘+’ icon from bottom to Make a Video and Use #tag to make that Video.
  • Upload relevant video of Given hashtag.
  • Every Hash Tag have a Prize Pool and after making your Own Video just send your Coins to that video to Make your chance to win Free PayTM Cash.
  • After your upload share link of video and send coins from another account to get votes.
  • Tap on Send Coins Option send Coins to your Video and make it Winner.
  • There is no minimum redeem and payment will arrive instantly in your paytm wallet.
  • You will get 250 Coins per Refer.

Thanks For Viewing...
Stay Connected with us :- Like us on fb 
😊❤️

Now Make Unlimited Calls All Over India Using Poptox

1 comment

Now Make Unlimited Calls All Over India Using Poptox .PopTox lets you makefree phone callsfrom your PC or Smartphone. You can use PopTox from any standard web browser. No need to download apps or plug-ins. Absolutely no payment is required. Simply enter the phone number and click on the “Call” button to start your first free call. Make entirely free calls to your loved ones today So Friends Hurryup And Make A Free Call Now.Dont forget To Share Us.





How To Make Free Call:-


1) Firstly Goto Poptox Official Site


2) Use Chrome For Better Experience.


3) Then Enter Your Mobile No Using Virtual Keyboard.


4) Now Select country code.


5) Now Make A Call.


6) If You are Using Chrome On Pc Then Allow Microphone Or Use Headphone.


7) Thats It!!


8) Talk With Any Of Your Friends.


This Trick Is Only For Educational Purpose Dont Misuse It..


Share Is Caring 👨


Tags : Best free online calling site/app ,free call,free Online calling app...


Keep visiting and stay Updated !! 


Get Rs.20 On Signup + Rs 35 By Completing A Simple Survey + Rs170 Per Refer

Leave a Comment


Hi, friends we are back with an amazing offer for. Earntalktime app gives free recharge by doing simple survey, downloading apps and watching videos. Now this app giving Rs.20 on signup and Rs 175 per refer. And it’s also has a amazing offer while you want to fill a simple survey and you will get Rs.35 in EarnTalktime account.




 


 


Steps To Use Earntalktime  App-:


First Of All Download Earntalktime App Here


Install And Open The App


Do Signup And Login Process


Yeah ! You Got Rs.20 As Signup Bonus


Now You Will A Banner Of Survey For Drink


Complete It By Answering Simple Question


You Will Get Rs.35 After Completing This Survey




Steps To Earn Upto Rs.175 Per Refer -:


Open the Earntalktime App


Now Go To Refer And Earn Option From Menu


Share Your Unique Link With Friends


And You Can Earn Upto Rs.175 Per Friends


You Can Redeem Your Earning As Free Recharge OR Gifts Vouchers


Share Is Caring 👨