JavaScript Cookies vs Local Storage vs Session Storage

แชร์
ฝัง
  • เผยแพร่เมื่อ 11 ม.ค. 2019
  • The ability to quickly store information on a user's browser is an incredibly under used, powerful feature of JavaScript, and this is partially because of how unwieldy it used to be. In this video I am going to discuss the differences between cookies, local storage, and session storage, and how dealing with browser storage has become much easier since the initial release of cookies. I will also talk about how to use cookies, local storage, and session storage to store information in a users browser.
    Cookies vs Local Storage vs Session Storage Article:
    blog.webdevsimplified.com/202...
    Twitter:
    / devsimplified
    GitHub:
    github.com/WebDevSimplified
    CodePen:
    codepen.io/WebDevSimplified
    #LocalStorage #Cookies #SessionStorage

ความคิดเห็น • 457

  • @oldbootz
    @oldbootz 4 ปีที่แล้ว +515

    and on the eve of the year 10000 there was the great cookie expiration crisis...

    • @dawid_dahl
      @dawid_dahl 4 ปีที่แล้ว +62

      oldbootz I’m here from the future to warn all you guys that you shouldn’t be setting your cookies to expire in the year 9999. Please. Human civilization depends on it.

    • @reveluv8851
      @reveluv8851 4 ปีที่แล้ว +3

      @@gl3nda96 set it to 1 ad

    • @nedaltrebor8553
      @nedaltrebor8553 3 ปีที่แล้ว +7

      @@gl3nda96 couldn't you set it programmatic. Like, get current year > add 2

    • @barbelljoe
      @barbelljoe 3 ปีที่แล้ว +14

      @@dawid_dahl shit I will have to find my password to login again.

    • @Ginfio
      @Ginfio 3 ปีที่แล้ว +3

      What kind cookies? Chocolate chip.. cookies..? Or
      Ok nvm.

  • @EduardKaresli
    @EduardKaresli 5 ปีที่แล้ว +371

    Man, you're as good as The Net Ninja, which is my current source of information. I hope you'll get many subscribers soon, your style is clear, short and to the point.
    Thanks!

    • @WebDevSimplified
      @WebDevSimplified  5 ปีที่แล้ว +110

      Thank you! That is a huge compliment. The Net Ninja has amazing content and was one of the sources of inspiration for my channel.

    • @dangerdoctor920
      @dangerdoctor920 2 ปีที่แล้ว +4

      Same I only watch net ninja and kyle

    • @shaikhasad2911
      @shaikhasad2911 ปีที่แล้ว +1

      Brad Traversy aka TraversyMedia, Shaun aka Net Ninja and Kyle aka WebDevSimplified, these guys are gold for webdevelopers especially for beginners!

    • @101kawsar
      @101kawsar ปีที่แล้ว +1

      Three years later, they have same amount of subscribers.
      Congrats Kyle 🤞

  • @bohdanromanovich4912
    @bohdanromanovich4912 2 ปีที่แล้ว +17

    This is simply the best TH-cam channel to quickly get to the bottom of a particular issue that you have without long explanations of things you don't need. For everything else, there is documentation. You help a lot of people, thank you so much!

  • @Jhonny610
    @Jhonny610 2 ปีที่แล้ว +148

    0:00 Overview
    4:56 LocalStorage
    8:10 SessionStorage
    9:43 Cookies

  • @BoLeee
    @BoLeee 3 ปีที่แล้ว +18

    Yo! Thanks for breaking down topics like this, many youtube searches lead to you and i'm never dissapointed. Thank you

  • @fabiajero
    @fabiajero 3 ปีที่แล้ว +73

    It would be great also if you explain the different situations you may use each of them and which security problems you could have, like for example, storing user session data (auth).
    Great video. Thanks

  • @_briantravis
    @_briantravis ปีที่แล้ว

    Your videos on JS are simply the best. Explain exactly what you need to know, nothing more and nothing less, in the most efficient way. Thank you so much!

  • @nehakumar9889
    @nehakumar9889 3 ปีที่แล้ว

    Crisp and clear explanation. Sir I have an interview tomorrow for an internship. I am watching this to revise the concepts and I chose the correct channel for this purpose. Amazingly explained and straight to the point.

  • @pastorfred2543
    @pastorfred2543 4 ปีที่แล้ว +55

    Today is my first time of seeing JS cookies and session storage.. I learnt local storage through MDN some time past.. Thanks Sir, I pray your Channel grows rapidly.

    • @WebDevSimplified
      @WebDevSimplified  4 ปีที่แล้ว +4

      Thank you! I'm glad my video was insightful for you.

    • @sumanthchippagiri1687
      @sumanthchippagiri1687 3 ปีที่แล้ว

      @@WebDevSimplified Hi bro.Your content is awesome and the way you simplifies is above that.I have some real doubts. I can explain in detail if you provide me your mail id.

  • @alanhunt3772
    @alanhunt3772 4 ปีที่แล้ว

    This is fantastic, I've been scratching my head a lot lately trying to differentiate session, storage, and cookies and then lining it up with session on the server side. I've started looking at how other websites do it through the browser dev tools and cookies seem to be the weapon of choice.

  • @steves1015
    @steves1015 4 ปีที่แล้ว +1

    You have a very clear and concise way of approaching the subject. I felt like I learned quite a lot in 15 minutes! Thank you!
    I hope you get many more views on your videos.

  • @19jewels95
    @19jewels95 4 ปีที่แล้ว

    Amazing. Clear, concise, straight to the point and beginner-friendly examples. You provide the perfect platform for beginners like me, and I'm always grateful :)

  • @ridl27
    @ridl27 4 ปีที่แล้ว +6

    Bro, You have a talent to share knowledge with us! So easy to follow and understand. You will have much more subscribers in the future for sure! Its all about of time =)

  • @karlomoonblade
    @karlomoonblade 4 ปีที่แล้ว

    keep the very detailed straight to point explanation , i really can understand the topic without watching several times

  • @Sam-xv5ko
    @Sam-xv5ko 4 ปีที่แล้ว +1

    I was searching here and there to learn these things and you really simplified them. Thank you, man, you saved my day. Subscribed

  • @harshilparmar9076
    @harshilparmar9076 5 ปีที่แล้ว +35

    bro... thanks for putting much effort..this channel is awesome!!

    • @WebDevSimplified
      @WebDevSimplified  5 ปีที่แล้ว +10

      Thanks! I love making these videos so it doesn't even feel like work. Well at least most of the time :P

    • @jeromelanteri6469
      @jeromelanteri6469 3 ปีที่แล้ว

      @@WebDevSimplified even if you do not copy what is existing already (and that is exactly the same) ?

  • @TimothySmithii
    @TimothySmithii 3 ปีที่แล้ว +41

    Best cookie video I've seen. You can tell this guy has a deep knowledge of the material with the way he effortlessly explains all the moving pieces.
    I know this is written with for Devs, but it's also a really good sort of introductory deep-dive into cookies. He did a great job of explaining the different types of cookies, how to identify them, what they do, and the reasons for why they are needed. Most concise yet jam packed with info video on any subject I've seen recently. Surprised to find it on the subject of web cookies, as in my experience it has been difficult to find videos that aren't either too shallow or too deep in their scope. This was perfect and I feel like I can take the next step without any huge gaps in my understanding now.
    Great job, thank you!

    • @CJFX_
      @CJFX_ 2 ปีที่แล้ว

      When you know what you're talking about you can put it in simple terms 😆

    • @jellegalgenbeld7226
      @jellegalgenbeld7226 2 ปีที่แล้ว

      lastName=Smith

    • @DenzelHooke
      @DenzelHooke 2 ปีที่แล้ว

      @@CJFX_ Sometimes yes, sometimes no

    • @ojasdighe991
      @ojasdighe991 ปีที่แล้ว

      @@DenzelHooke precise

    • @youvegotmail9385
      @youvegotmail9385 ปีที่แล้ว

      He's the man. Crazy knowledgeable.

  • @NITESHSINGHNRS
    @NITESHSINGHNRS 4 ปีที่แล้ว +1

    Every day I am learning from your channel...great work ..

  • @quicksilvuhh
    @quicksilvuhh 4 ปีที่แล้ว +1

    You're great at explaining things. I'm very grateful!

  • @bdk9830
    @bdk9830 3 ปีที่แล้ว +1

    The best lecture of cookies and storages in the world. thanks Kyle !

  • @ekaterinaastrid2636
    @ekaterinaastrid2636 3 ปีที่แล้ว +4

    I really love u, man! this is the best channel about coding.

  • @erikstone8336
    @erikstone8336 2 ปีที่แล้ว

    First: nice.
    Second: thank you, I’ve been trying to understand cookies vs session storage and which to use and when, your video cleared up a lot!
    Thanks again

  • @rohitkudalkar92
    @rohitkudalkar92 4 ปีที่แล้ว +1

    Thank you sir. This is what I was searching for. Thanks bro all your unique videos with best example. Love and support ❤️

  • @happyv6872
    @happyv6872 4 ปีที่แล้ว +8

    Man, what a beautiful set of eyes! Your voice is also very nice to listen to. You deserve more subs and views.

  • @horrorbreakdown
    @horrorbreakdown 4 ปีที่แล้ว +15

    Great channel, I've learned a lot. You're very clear and to the point.

  • @farshadgh2011
    @farshadgh2011 3 ปีที่แล้ว +1

    Great tutorial, thanks.
    It's crazy how express-session uses cookies for server-side.

  • @giorgieliozashvili633
    @giorgieliozashvili633 ปีที่แล้ว

    Hey Kyle! Thanks. basically, you taught me React and these little things in javascript. Thank you. You're a huge time saver

  • @langsonchibili1329
    @langsonchibili1329 4 ปีที่แล้ว

    THERE IS A REASON WHY *I'VE SUBSCRIBED* TO THIS GUYS CHANNEL, HE'S SO HUMBLE, AND VERY INTELLIGENT AT GETTING THE CONCEPTS IN ONE'S HEAD, AND HE'S SO KNOWLEDGE-PACKED. I AM A FAN AND A STUDENT OF YOURS NOW. MR.

  • @erykczajkowski8226
    @erykczajkowski8226 2 ปีที่แล้ว +5

    Great explanation of the differences! I think it would be useful if you provided some info on the security concerns and proposed some actual libraries for cookies management.

  • @pallad1461
    @pallad1461 ปีที่แล้ว

    Best tutorials about web developing on TH-cam

  • @jayreyes828
    @jayreyes828 2 ปีที่แล้ว

    My goodness you are covering all the necessary topics, my friend

  • @Alireza-kw6fj
    @Alireza-kw6fj ปีที่แล้ว

    missed your voice for about 6 month after you full javascript course, I'm happy to hear you again ;)

  • @jayteecollins1279
    @jayteecollins1279 5 หลายเดือนก่อน

    Your explanation is always on point! Good job!

  • @anikdas5218
    @anikdas5218 2 ปีที่แล้ว +3

    Why I love his videos! Because his contents is to the point. No extra shit.

  • @shawnyiwerd
    @shawnyiwerd ปีที่แล้ว

    Tack för att du delar med dig. Jag har använt Morelogin nyligen och det skyddar integriteten.

  • @master_ofnone
    @master_ofnone 2 ปีที่แล้ว

    This was a great video! Detailed yet concise. Defs subscribing :)

  • @TaskSwitcherify
    @TaskSwitcherify ปีที่แล้ว +3

    Great video. FYI: 10 MB and 5 MB means MEGABYTES, which is 8x larger than megabits.

  • @user-lq1mm2tn5v
    @user-lq1mm2tn5v ปีที่แล้ว

    Many thanks for such clear and structured explanation!

  • @kagisohadebe9913
    @kagisohadebe9913 4 ปีที่แล้ว

    my first web dev video and it was hella helpful thanks for it , liked & subscribed looking forward to more content

  • @kj6372
    @kj6372 3 ปีที่แล้ว

    Thank you so much for uploading such a simple and easy to understand tutorial video

  • @faithyintii8457
    @faithyintii8457 4 ปีที่แล้ว

    Thanks man... it was quick, straight to the point and informative... i am grateful.
    you just earned a new sub... :)

  • @jevessonsouza7947
    @jevessonsouza7947 ปีที่แล้ว

    2 words: Thank You!
    Your videos have been help me a lot!!!

  • @underwater2003
    @underwater2003 2 ปีที่แล้ว

    First working tutorial i found in half of year! Thanks!

  • @gregruiz921
    @gregruiz921 ปีที่แล้ว

    Great overview Kyle... appreciate how you showed everything real time with code and the dev tools. Thanks!

  • @user-oy4kf5wr8l
    @user-oy4kf5wr8l 4 ปีที่แล้ว +1

    Thank you man, simple and clear

  • @breebw
    @breebw 3 ปีที่แล้ว +11

    3:31 mid 2020, Apple(iOS and desktop Safari, is implementing a new localstorage rule. Its a game changer.
    "Specifically, Safari will erase IndexedDB, LocalStorage, Media keys,
    SessionStorage, and Service Worker registrations after seven days if the
    user does not interact with the associated website during this period."

  • @WilsonGalter
    @WilsonGalter 4 ปีที่แล้ว +1

    Dude, I had to learn about session storage today on the go in order to create a user login in system!
    I wish I had seen this video before that!

  • @BORIS_NEKEZOV
    @BORIS_NEKEZOV 3 ปีที่แล้ว +1

    Thank you for that good explanation, Kyle!

  • @doylemcteller1335
    @doylemcteller1335 4 ปีที่แล้ว +1

    Dude, you‘re always on point. Thanks a lot.

  • @siamesedev3646
    @siamesedev3646 4 ปีที่แล้ว +1

    Thanks Jordi! You're the man!

  • @sruthisoman6533
    @sruthisoman6533 3 ปีที่แล้ว

    Excellent presentation. This helped me understand the concept so much better. Thank you✌️

  • @giordanovaldez8348
    @giordanovaldez8348 4 ปีที่แล้ว

    Liked and subscribed. Great explanation for everything. Keep up the good work!

  • @raybagss
    @raybagss 3 ปีที่แล้ว +1

    Thank you so much. This really explained everything really well.

  • @govinda399
    @govinda399 2 ปีที่แล้ว

    you are my favourite content creator. I watch alot of your videos nowadays.

  • @swibay
    @swibay 4 ปีที่แล้ว +1

    You inspire me a lot dude! Tanzania🇹🇿

  • @frontend3409
    @frontend3409 ปีที่แล้ว

    That table at the beginning is helpful. You could show however how (or when) cookies are sent to the server. As i checked in developer tools, they're sent before first call to the webpage

  • @SubhobrotoRoy
    @SubhobrotoRoy 5 ปีที่แล้ว +4

    Thank you for making such an informative video!!!

  • @AnvarAzizovMusic
    @AnvarAzizovMusic 3 ปีที่แล้ว

    Thank you for the detailed explanation.

  • @steven5712
    @steven5712 3 ปีที่แล้ว

    Thanks, man. You are awesome. I was just wondering how Redux persist works and this video came up in my recommendation. Great stuff!

  • @briandacallos4234
    @briandacallos4234 3 ปีที่แล้ว +1

    You never disappoint me kyle

  • @SepSol75
    @SepSol75 3 ปีที่แล้ว

    As always fantastic explanation

  • @devanshishah9481
    @devanshishah9481 2 ปีที่แล้ว

    Nicely explained. Thank you for passing the knowledge!!

  • @riznimohamed
    @riznimohamed 2 ปีที่แล้ว

    Best explanation. I learned what I exactly need to know

  • @youvegotmail9385
    @youvegotmail9385 ปีที่แล้ว

    Opening chart was super helpful .

  • @user-jm9rh4ef2z
    @user-jm9rh4ef2z 2 ปีที่แล้ว

    Thanks Kyle! you explained it very clearly !!!

  • @_wekesar_6639
    @_wekesar_6639 3 ปีที่แล้ว

    Web dev has never been simpler.. Thanks wds 😌

  • @rahulbhatia1313
    @rahulbhatia1313 4 ปีที่แล้ว +1

    I did not knew Jordi el niño also had a web development youtube channel. great work, keep it!

  • @ca7986
    @ca7986 ปีที่แล้ว

    What an amazing explaination! you are amazing dude!

  • @JoeDebono
    @JoeDebono 3 ปีที่แล้ว +1

    - Thanks buddy, if only I had watched this video when I was learning to bake cookies! Local Storage is what I actually needed then but didn't know it. Your commentary is crisp and clear as is your visual display style. I'm a teacher by trade so I recognise a good communicator when I see one. Thank you sincerely.

  • @Sh0Eng
    @Sh0Eng หลายเดือนก่อน

    i liked the video before watching it. this is how much i trust this guy.

  • @lucaspedro6488
    @lucaspedro6488 2 ปีที่แล้ว +1

    Thank you very much for the explanation. Very helpful content. Keep it up!!

  • @videogamesare1
    @videogamesare1 4 ปีที่แล้ว

    This video, the CSS position video...you are the real deal

  • @creativebob7308
    @creativebob7308 4 ปีที่แล้ว

    Encountered an interesting bug when working with redux-persist recently. Redux-persist was working just fine on my desktop computer by saving the current redux state to my web browser's local storage.
    I pulled from my local git repo on my mac and begin implementing a new action for my reducer. Next thing I know, all of my redux related functions are causing the application to break.
    As it turns out, I had created a logic error within my reducer, but fixing the logic error itself did not solve the problem. Why? Because redux-persist had already saved that logic error into that browsers local storage. Local storage also does not automatically purge itself, so the solution was for me to delete that browsers local storage and then re-run the application.
    Lucky for me, I had watched this useful video before using redux-persist to figure out how local storage actually works, as I had not previously used it in the past.
    Great learning experience and the video really helped!

  • @ZazaMasta
    @ZazaMasta 3 ปีที่แล้ว +10

    This guy has done everything I need, he is a walking institution !

  • @adonsav
    @adonsav 9 หลายเดือนก่อน

    Thanks for your videos! Great work 🙏

  • @smurffronda2951
    @smurffronda2951 2 ปีที่แล้ว

    thanks man, have a great week

  • @asimgiri4269
    @asimgiri4269 3 ปีที่แล้ว +3

    In order to pass object as values in local/session storage :
    const obj = {value: 1, state: true, name: 'I am object one'};
    localStorage.setItem('myObject', JSON.stringify(obj));

  • @jagdishshetty4782
    @jagdishshetty4782 4 ปีที่แล้ว +3

    Really useful !!! Thx so much !!! Keeping making more videos !!!

  • @azimmalpekar9072
    @azimmalpekar9072 2 ปีที่แล้ว +1

    Very good explanation, to the point.

  • @MuhammadAwais-007
    @MuhammadAwais-007 5 ปีที่แล้ว +1

    that video saved a lot of time, thanks man

  • @dealstunner8317
    @dealstunner8317 3 ปีที่แล้ว

    Fantastic as always 👍

  • @official.mhm13
    @official.mhm13 3 ปีที่แล้ว

    this video really helped me understand... thank you

  •  2 ปีที่แล้ว

    thank you so much. make me clearly about the concept of them.

  • @ticossauro
    @ticossauro 3 ปีที่แล้ว

    Great content! Thank you!

  • @MarioDev
    @MarioDev 4 ปีที่แล้ว

    Man, you do the best video

  • @a_maxed_out_handle_of_30_chars
    @a_maxed_out_handle_of_30_chars 10 หลายเดือนก่อน +2

    thank you, simple and to the point :)

  • @a4yster
    @a4yster ปีที่แล้ว

    Kyle is rockin' it!

  • @iqbalkhatridr
    @iqbalkhatridr 2 ปีที่แล้ว

    Excellent and simple video.

  • @michalkrajewski7092
    @michalkrajewski7092 4 หลายเดือนก่อน

    You did it, thanks, that's the explanation I was looking for, Regards

  • @arnobislam1615
    @arnobislam1615 ปีที่แล้ว

    amazing and simplest explanation

  • @mehtabahmed6092
    @mehtabahmed6092 3 ปีที่แล้ว

    Thank you so much for the nice explanation

  • @mosiurrahman4061
    @mosiurrahman4061 3 หลายเดือนก่อน

    Clean Lecture.

  • @KILLCHRISU
    @KILLCHRISU ปีที่แล้ว +1

    kyle you’ve helped me once again thank u

  • @rishengopaldass1103
    @rishengopaldass1103 3 ปีที่แล้ว

    Amazing video. Thank you.

  • @TheAssasinsBreed
    @TheAssasinsBreed 3 ปีที่แล้ว

    i really love your videos. you are doing great job. here is a hint to make your coding faster. just hit F1 and type configure user snippets and make easy snippet suitable for you. since it is really pain to type console logs each time. mine works like this "i just type log and hit enter and it pastes console.log() with pointer being in mid of parentheses which is really quick." you should really consider applying this. thanks!

  • @ghazanfarabbas4187
    @ghazanfarabbas4187 2 ปีที่แล้ว

    Thank for such valuable tutorial.

  • @samcodes2912
    @samcodes2912 3 ปีที่แล้ว

    short explanation and clear as water 👍

  • @joseantoniovela9599
    @joseantoniovela9599 ปีที่แล้ว

    thanks for all, you are the best !!!!!!!!!!

  • @piriyaie
    @piriyaie 2 ปีที่แล้ว

    Thank you for this great video.

  • @webeingmarketingteam5881
    @webeingmarketingteam5881 ปีที่แล้ว

    Thanks, that was super useful! 🙏