How To Send Push Notifications With JavaScript

Поділитися
Вставка
  • Опубліковано 14 січ 2025

КОМЕНТАРІ • 441

  • @danielegvi
    @danielegvi 2 роки тому +704

    This is a great introduction to regular notifications, but these are NOT push notifications, the video title is misleading. In order to make push notifications, you must pair the Notification API with the Push API (see MDN docs) in server workers. You should update the title of the video to reflect that.

  • @chrisodillman3355
    @chrisodillman3355 2 роки тому +106

    My take away from this tutorial i just watched because it sounded interesting is: i know it exists, i know it is easy to do, i know where to find a tutorial. Thanks a lot Kyle

  • @ChronSyn
    @ChronSyn 2 роки тому +375

    Correction: this is known as a local notification, not a push notification. They are both part of the umbrella term of notifications but have entirely different implementations.
    A push notification is triggered with data sent from a remote origin, typically an APN (iOS), GCP (Android) or via the web push API connected to a remote server. The remote data provider pushes the data to the client, hence the term 'push notification'.
    A local notification is triggered from within a web page or app, and does not rely on a remote origin to provide data. The local notification can be displayed with data retrieved from a remote source, but this is not the same as a push notification.

    • @alexdominguess
      @alexdominguess 2 роки тому +6

      So the notification done in this way would work if the user is not with the page opened?

    • @petergg9096
      @petergg9096 2 роки тому +10

      @@alexdominguess no it wont

    • @Pekerjarimot
      @Pekerjarimot 2 роки тому +1

      ​@@alexdominguess no

    • @kiyokodyele
      @kiyokodyele 2 роки тому +7

      this is what I've been looking for the entire video. I made a push notification with node NodeJS and I could still remember that there is VAPID thing you need to be able to send push notification. I was confused when he said you can send push notification with just client-side JavaScript.

    • @ricky8466
      @ricky8466 2 роки тому +1

      thank you for the correction, if not because you, i'll misguided too

  • @rolitorape3020
    @rolitorape3020 2 роки тому +8

    This guy is God sent. The explanation is sooo clean

  • @sayatraykulov
    @sayatraykulov 2 роки тому +12

    Your tutorials are the best for me through the whole youtube. Useful information in every seconds, and nothing else.

  • @KomentatorBre
    @KomentatorBre 2 роки тому +18

    This is great. Would be even better if we got a video on the Push API :)

    • @advem.
      @advem. 2 роки тому

      Exactly. But pls avoid firebase. Custom nodejs app is way better in terms of customization and controle

  • @blazerhm
    @blazerhm 2 роки тому +1

    We need more videos like this!

  • @shahmir3565
    @shahmir3565 2 роки тому +6

    Your way Of Teaching Is Awesome ❤️

  • @yasirtahirkheli74
    @yasirtahirkheli74 2 роки тому +42

    Too good and an excellent addition to my code arsenal. Long live mate.

    • @i0x37
      @i0x37 2 роки тому

      @John REST IN PISS QUEEN, SMOKING ON THE ROYAL PACK 🚬🚬🚬

    • @brendon205
      @brendon205 2 роки тому +2

      @John 💀

    • @HypnosisBear
      @HypnosisBear 2 роки тому +3

      @John Queen what??!! What are you on?

    • @rednexie
      @rednexie 2 роки тому +2

      @John dude...

    • @farhanaditya2647
      @farhanaditya2647 2 роки тому

      @John ayo

  • @amrmashaal834
    @amrmashaal834 5 місяців тому +1

    Bro, You really one of the best people that teaching programming on youtube. i have learnt a lot of things from you and your explanation was amazing

  • @otabekkadirov2578
    @otabekkadirov2578 2 роки тому +2

    Thank you Kyle. I'm from Uzbekistan and Im learning web programming. You really simplify the web!

  • @vugarbakhshalizade2826
    @vugarbakhshalizade2826 2 роки тому +26

    Yet another high value tutorial. Thank you!

  • @NoFaceDev
    @NoFaceDev 2 роки тому +1

    Thank you man i was looking for this video

  • @randomuser23493
    @randomuser23493 Рік тому

    Very useful video. Glad I'm part of your subscribed viewers Kyle. Keep it up!

  • @AlexCernat
    @AlexCernat 2 роки тому +31

    great video about notifications! but beware! notifications only, not push notifications! for push notifications you must first subscribe to push notifications on a web page / site, and then the server will send those push notifications, no matter if the browser is on that page or that page is closed; of course, after receiving a push notification you will show it to the user like the examples in this video

    • @ksrele
      @ksrele 2 роки тому +1

      Do you need background workers for this to work?
      @Web Dev Simplified can you make a tutorial on workers, what they are and how to use them?

    • @DaviddeKloet
      @DaviddeKloet 2 роки тому +4

      @@ksrele yes you need a service worker on the client to listen for the notifications and you need some cryptography to communicate between the server and the client.

  • @cbennder3877
    @cbennder3877 2 роки тому

    i looked long time for a video like this. Thank you.

  • @guidingtechbd
    @guidingtechbd 2 роки тому +1

    Awesome explanation. I owe you!! 😊

  • @ahmad98282
    @ahmad98282 2 роки тому +2

    I love the way you research something for a video. Now this can't be more explained than you have already done

    • @arjix8738
      @arjix8738 2 роки тому +1

      It is super easy to learn stuff about the notifications API, so it does not require much research, but the point still stands that he makes nice explanations.
      And that is all that matters. :thumbsup:

    • @ahmad98282
      @ahmad98282 2 роки тому +1

      @@arjix8738 Thats what i said in fewer lines

    • @arjix8738
      @arjix8738 2 роки тому

      @@ahmad98282 no, you did not say that the notifications API is super easy and needs no research at all, you can literally just read the docs, there is no need for a tutorial, but I am not saying that this is a worthless video

  • @TheGeekosDen
    @TheGeekosDen 2 роки тому

    I'm the guy who told you to blink your eyes a bit more when you only had like 7k subscribers. Congratulations on 1 million, also you are doing good with blinking 👁️💪

  • @krateskim4169
    @krateskim4169 2 роки тому

    you are such a good teacher man

  • @giorgosMih
    @giorgosMih 2 роки тому +111

    Nice tutorial, thanks! Please do a tutorial on PWA & Web push notifications (for when the browser is closed to keep receiving notifications). They are kinda complex, but I think you will be able to explain them very clearly.

  • @zulhilmiomar1491
    @zulhilmiomar1491 2 роки тому +2

    such a high value tutorial and info! thanks kyle!

  • @dickypb7703
    @dickypb7703 3 місяці тому

    Well explained, thanks man 💙

  • @GetushaHD
    @GetushaHD 2 роки тому

    The COME BACK please is having me dead.😂

  • @ubeydeozdmr
    @ubeydeozdmr 2 роки тому

    It's been great to have this video posted recently as I've been thinking about how to do this for my app. Thank you so much

  • @lacamoura
    @lacamoura 2 роки тому

    Yooo i needed this for my project, thanks a lot

  • @mengsreangchannel6180
    @mengsreangchannel6180 2 роки тому +1

    Thanks *Kyle* for sharing a good tutorial like this.

  • @mustafaibrahim2558
    @mustafaibrahim2558 2 роки тому

    I was looking for this video in your channel. But now i got it. Big ❤ bro.

  • @jobsunday833
    @jobsunday833 2 роки тому

    Thanks! I've been searching how to get it and this is brilliant :D

  • @mallipooalwa9085
    @mallipooalwa9085 2 роки тому

    Your the best in covering useful Javascript API's

  • @jimmymedia2049
    @jimmymedia2049 2 роки тому +4

    As mentioned by @chronSyn below this is not a push notification, that requires a backend service to 'push' the notification based on some event to the browser even when you are not viewing the page. Google has a push api but most are paid and a little complex to implement.

  • @MdNaimurRahmanHera
    @MdNaimurRahmanHera 2 роки тому

    Really learned some new things bro. Love you

  • @amershboul9107
    @amershboul9107 2 роки тому

    you deserve a huge like 👍🏻👍🏻

  • @bobdinitto
    @bobdinitto 2 роки тому

    Very, very awesome Kyle! I've always wondered how these notifications work. Thanks!

  • @loordbeerus6284
    @loordbeerus6284 2 роки тому +2

    You are awesome i love your content keep going ♥

  • @BroScro
    @BroScro 2 роки тому

    thank you kyle.
    how awesome is this!

  • @LacMatMuaXuan
    @LacMatMuaXuan 2 роки тому

    Thank you so much! Your clips are really useful for me and other people.

  • @matheusmartino5738
    @matheusmartino5738 2 роки тому

    I will have to implament that next week at my job. Perfect timing. Thank you so much!

  • @dimitargetsov9690
    @dimitargetsov9690 2 роки тому +1

    Even without Push API , still, CONCISE,INFORMATIVE,MEANINGFUL...GREAT!

  • @ohmwai
    @ohmwai 2 роки тому

    Damn. I needed this like a week ago lol. But it's still a great learning experience.

  • @moishinetzer
    @moishinetzer 2 роки тому

    Stuff like this is awesome, I think your CSS stuff is good but this is what people really want!

  • @sandeeptottadi
    @sandeeptottadi 2 роки тому +3

    Super exciting content!

  • @rulesofsuccessfullife6098
    @rulesofsuccessfullife6098 11 місяців тому

    The video was helpful thank you for making me better than before

  • @thiagopintobraga6174
    @thiagopintobraga6174 2 роки тому

    Great lesson, thank for sharing this. Tomorrow I will introduce this in some systems that Im building

  • @siya.abc123
    @siya.abc123 2 роки тому

    Cheers for this tutorial man !

  • @kingstalker
    @kingstalker 2 роки тому

    nice didin't expect that really good well done

  • @armageddonvivas9243
    @armageddonvivas9243 2 роки тому

    ITS REALLY WORKED LOL THANK YOU DUDE

  • @nziokaaustin
    @nziokaaustin 2 роки тому

    tutorial added to my "to try list" asap

  • @crkvend
    @crkvend 2 роки тому +10

    I don’t think I’m being pedantic when I say that local notifications, the obvious subject of this video, are not push notifications.
    This is a pretty clickbaity title.

    • @LuBre
      @LuBre 2 роки тому

      Came here to verify this...

    • @SLRModShop
      @SLRModShop 2 роки тому

      Trying to wrap my head around how this could be useful... Doesn't seem to add anything that you couldn't do yourself as he's basically using them as info modals...
      I'd like to create some, but my site is multi-user (like most sites) and this solution would send a notification to EVERYONE (which is not ideal in 99% of cases)... So, I guess real push notifications HAVE to come from the back end, else they are just modals... no?

    • @crkvend
      @crkvend 2 роки тому

      @@SLRModShop they are not modals and can be shown outside of the browser window.
      The usability of this is pretty limited, but let’s say you have a page that periodically polls some data or similar, and notifies the user when something in particular comes up.
      With local notifications (and a browser that doesn’t suspend JavaScript execution) the user could be doing something else in a different tab, or even a different app, and get notified even tho the browser might be minimized.

    • @SLRModShop
      @SLRModShop 2 роки тому

      @@crkvend oooh, that's a good call... I'm trying to minimize the amount of calls to the database but yeah, that's definitely an option to use the front to poll the back and act on that... Ok... Now I have some thinking to do ^-^ Might be more powerful than I realise...

    • @crkvend
      @crkvend 2 роки тому

      With all this said, I no way wanted to bash Kyle, I’ve been a professional developer for more that 10 years and still keep learning new things from his videos!

  • @ilyesbejia6566
    @ilyesbejia6566 2 роки тому

    Thanks for sharing those are great materials

  • @Light_Of_Quran-Only_1
    @Light_Of_Quran-Only_1 2 місяці тому

    you have a great box of contents

  • @larrydev
    @larrydev 2 роки тому

    I always wondered how this worked. Thanks!

  • @slametnugroho6535
    @slametnugroho6535 2 роки тому

    wow, thank you so much, it was a big help

  • @zorogenius
    @zorogenius Рік тому

    You earnt a subscribe, my friend.

  • @musha3368
    @musha3368 2 роки тому

    Nice! Good job bro, best tutorials!

  • @dclxviclan
    @dclxviclan 2 роки тому

    New level knowledge, thanks bro 👍

  • @MoggersGG
    @MoggersGG 2 роки тому +4

    Great tutorial! Though the JS notification api isn’t fully supported on phones. It isn’t even possible on IOS as of now and chrome on android needs service workers.
    Just additional information :)

  • @kuroexmachina
    @kuroexmachina 2 роки тому

    always cool to see native stuff

  • @pauserratgutierrez
    @pauserratgutierrez 2 роки тому

    Wow, your knowledge is amazing. Thanks for all buddy!!

  • @maxwellosuji4096
    @maxwellosuji4096 2 роки тому

    I’ve been thinking of additional features to my website and this helps alot thanks kyle❤️

  • @beinyourguard
    @beinyourguard 2 роки тому

    amazing! again, nice to see that JS is so powerful

  • @albertoiong6895
    @albertoiong6895 2 роки тому

    Thanks for the tutorial... As in my case of Win10, go to [Settings] -> [System] -> [Notifications and Actions] then turn on [Get notifications from apps and other senders] and everything works fine...

  • @adsaviation
    @adsaviation 7 місяців тому

    Wow, I love this short and the way he was explaining it, EXCELLENT. Not one time I felt lost or disorientated. K.I.S.S. is the way to go!!😀

  • @luis96xd
    @luis96xd 2 роки тому +2

    Amazing tutorial, the best I've seen, it was well explained and in 11 minutes, thanks 👏💯👍😄👍

  • @master-b8437
    @master-b8437 2 роки тому

    Nice one Kyle. Noticed the ".... get rid of this sh!t" tho 😅

  • @shaikhyamin3464
    @shaikhyamin3464 2 роки тому

    I justtttt wanted to learn about push notification and you got me

  • @hackytech7494
    @hackytech7494 2 роки тому

    Thanks a lot for this fantastic video. Best explanation ever.

  • @nottydread
    @nottydread 2 роки тому

    Ooh, very interesting! Great tutorial.

  • @hussamalhinaty2340
    @hussamalhinaty2340 2 роки тому

    Very helpful and well explained

  • @Ahmedhkad
    @Ahmedhkad 2 роки тому

    It's cool to try on the phone! For my own site notification

  • @nielslytzdk
    @nielslytzdk 2 роки тому

    You make killer content 👍. Good teacher too!

  • @thephenomenalone482
    @thephenomenalone482 2 роки тому

    7:43 Imagine if that was real.😂🔥Thanks for the video anyway. 👍

  • @MrProxy10
    @MrProxy10 2 роки тому

    Just Amazing man❤❤❤❤

  • @tempaccount8256
    @tempaccount8256 2 роки тому

    This is a very good tutorial for notification. I just wanted to have this kind of feature for my project. Thanks😁

  • @rawsmoke8148
    @rawsmoke8148 2 роки тому

    So brilliant! Thank you!

  • @isabelphillips451
    @isabelphillips451 2 роки тому

    Wow! Thank you so much for this video ... I learnt a lot in one video 😍😍😍

  • @hikari1690
    @hikari1690 2 роки тому

    Perfect! Now I can annoy people more jist for fun 🤣

  • @entrey_ua
    @entrey_ua 2 роки тому

    Cool! Thank for a great tutorial.

  • @abuzargafari8366
    @abuzargafari8366 2 роки тому +1

    Awesome bro.....

  • @Wawa-nh9sq
    @Wawa-nh9sq 2 роки тому +2

    But it's actually not push notifications, if my app is closed I don't receive anything like we see in the thumbnail

  • @hassaneoutouaya
    @hassaneoutouaya 2 роки тому

    Thank you so much!

  • @joshuajoshua334
    @joshuajoshua334 2 роки тому

    Welldone bro. Love your tutorials. I however belive I am stuck in the tutorial hell. Been doing Front dev for a month. No job or internship yet

  • @ridermonkyt
    @ridermonkyt 2 роки тому

    Tag is the thing I learnt new.

  • @akoladebode-ajayi327
    @akoladebode-ajayi327 10 місяців тому +1

    Hi sir. Please why is that the modification method used in this video works for only PC and not in Android browsers

  • @medAmineRg
    @medAmineRg 2 роки тому

    thanks max thats really helpfull

  • @nikhil6842
    @nikhil6842 2 роки тому

    Great video Kyle

  • @amittraspal
    @amittraspal 2 роки тому +1

    Amazing Stuff, as always...... Please make one with React PWA and Web... I believe your tutorial would be so much better to wrap my head around.

  • @yusufsaify6735
    @yusufsaify6735 2 роки тому +1

    Great man 👍🏻

  • @rebarius
    @rebarius 2 роки тому +9

    Actually you‘re developing „Local Notifications“. These aren‘t real „push“ notifications while the web app or app is closed.
    For real push notifications you need a middleware (like FCM) the Connection to the Providers (Apple, Google,…) and your own backend (like nodejs) where you‘re sending out real push notifications.

  • @rojonali3374
    @rojonali3374 2 роки тому

    I was thinking for a few days about sending you an email to make a video about PWA and push notifications. Here is the part of those. Thanks

  • @ArielZab
    @ArielZab 2 роки тому +2

    Can you show us how to monitor ajax loading progress? So we can make something like a progress bar?

  • @lorenzomijorus
    @lorenzomijorus 2 роки тому +2

    hi kyle, could you do a video tutorial on how to send background notifications (like facebook does on android when the browser is closed)?

  • @josephlivengood4508
    @josephlivengood4508 Рік тому

    That was so cool, but how do I send a notification of a new blog post or something to bring them back to the website?

  • @vansh1190
    @vansh1190 Рік тому

    That's really an informative Video,
    Thanks @kyle

  • @CMB696
    @CMB696 2 роки тому +1

    I granted the permission but if I wanted to push a message to notification the console shows (Failed to construct 'Notification': Illegal constructor. Use ServiceWorkerRegistration.showNotification() instead) in my mobile;😐😩😔

  • @sven_93
    @sven_93 2 роки тому +2

    Would have really liked to see how the Notifications look and work for mobile usage.
    Also interesting would be the mobile Notifications on a PWA, which looks and feels like a mobile App.

    • @universo_desconocido
      @universo_desconocido Рік тому

      hey man did you find anything like that? I am searching for the same thing

  • @jeffryansyahputra3765
    @jeffryansyahputra3765 2 роки тому

    nice tuts...

  • @RAZR_Channel
    @RAZR_Channel 2 роки тому

    SUP Vanilla ICE...?

  • @programador-visual
    @programador-visual 2 роки тому +1

    The inevitable question: is there a way to store that browser data, to send a notification later, when the browser is closed?

    • @SLRModShop
      @SLRModShop 2 роки тому +1

      If the browser is closed, then you can't do that. At least I'm assuming. Sounds to me like you're trying to receive mail without a mailbox basically.
      Could be wrong but if the browser is close and it's in charge of the notification, then the browser can not send anything...
      You you probably need are some webhooks and fire the notification from your backend when you want, but the recipient's browser will need to be active.
      Not a pro at all so, don't take my word for it.

    • @programador-visual
      @programador-visual 2 роки тому

      @@SLRModShop no worries, thank you for the reply. I know some browser have like processes open even when closed so, maybe.. gonna test now

    • @Pacvalham
      @Pacvalham 2 роки тому

      Not with this API, but it is possible with the Push API.

  • @DarkOceanShark
    @DarkOceanShark 2 роки тому +1

    What is the purpose of "Welcome Message" value to the tag attribute? I understand what tag is doing but what purpose is "Welcome Message" serving?