How To Send Push Notifications With JavaScript

  Рет қаралды 359,373

Web Dev Simplified

Web Dev Simplified

Күн бұрын

Пікірлер: 441
@danielegvi
@danielegvi 2 жыл бұрын
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.
@porroapp
@porroapp 2 жыл бұрын
Push API isn't supported by Safari.
@fullstack_journey
@fullstack_journey 2 жыл бұрын
+1
@mohammedg485
@mohammedg485 2 жыл бұрын
+1
@Wawa-nh9sq
@Wawa-nh9sq 2 жыл бұрын
+1
@Scuffy
@Scuffy 2 жыл бұрын
@@porroapp yea only on apps not safari which is a L
@ChronSyn
@ChronSyn 2 жыл бұрын
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 жыл бұрын
So the notification done in this way would work if the user is not with the page opened?
@petergg9096
@petergg9096 2 жыл бұрын
@@alexdominguess no it wont
@Pekerjarimot
@Pekerjarimot 2 жыл бұрын
​@@alexdominguess no
@kiyokodyele
@kiyokodyele 2 жыл бұрын
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 жыл бұрын
thank you for the correction, if not because you, i'll misguided too
@chrisodillman3355
@chrisodillman3355 2 жыл бұрын
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
@rolitorape3020
@rolitorape3020 2 жыл бұрын
This guy is God sent. The explanation is sooo clean
@sayatraykulov6225
@sayatraykulov6225 2 жыл бұрын
Your tutorials are the best for me through the whole youtube. Useful information in every seconds, and nothing else.
@amrmashaal834
@amrmashaal834 4 ай бұрын
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
@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...
@otabekkadirov2578
@otabekkadirov2578 2 жыл бұрын
Thank you Kyle. I'm from Uzbekistan and Im learning web programming. You really simplify the web!
@KomentatorBre
@KomentatorBre 2 жыл бұрын
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
@shahmir3565
@shahmir3565 2 жыл бұрын
Your way Of Teaching Is Awesome ❤️
@AlexCernat
@AlexCernat 2 жыл бұрын
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 жыл бұрын
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 жыл бұрын
@@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.
@ahmad98282
@ahmad98282 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 жыл бұрын
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 жыл бұрын
@@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
@randomuser23493
@randomuser23493 Жыл бұрын
Very useful video. Glad I'm part of your subscribed viewers Kyle. Keep it up!
@yasirtahirkheli74
@yasirtahirkheli74 2 жыл бұрын
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 жыл бұрын
@John 💀
@HypnosisBear
@HypnosisBear 2 жыл бұрын
@John Queen what??!! What are you on?
@rednexie
@rednexie 2 жыл бұрын
@John dude...
@farhanaditya2647
@farhanaditya2647 2 жыл бұрын
@John ayo
@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 👁️💪
@jimmymedia2049
@jimmymedia2049 2 жыл бұрын
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.
@vugarbakhshalizade2826
@vugarbakhshalizade2826 2 жыл бұрын
Yet another high value tutorial. Thank you!
@blazerhm
@blazerhm 2 жыл бұрын
We need more videos like this!
@giorgosMih
@giorgosMih 2 жыл бұрын
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.
@kirarevcrow
@kirarevcrow 2 жыл бұрын
That would be super cool to have such a tutorial
@luis96xd
@luis96xd 2 жыл бұрын
Yes, please! 😄
@adamchubbuck9480
@adamchubbuck9480 2 жыл бұрын
Yes please!
@rageblast1468
@rageblast1468 2 жыл бұрын
Yes please
@ericwilfer8410
@ericwilfer8410 2 жыл бұрын
Yes please
@mallipooalwa9085
@mallipooalwa9085 2 жыл бұрын
Your the best in covering useful Javascript API's
@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!!😀
@mustafaibrahim2558
@mustafaibrahim2558 2 жыл бұрын
I was looking for this video in your channel. But now i got it. Big ❤ bro.
@dimitargetsov9690
@dimitargetsov9690 2 жыл бұрын
Even without Push API , still, CONCISE,INFORMATIVE,MEANINGFUL...GREAT!
@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
@cbennder3877
@cbennder3877 2 жыл бұрын
i looked long time for a video like this. Thank you.
@NoFaceDev
@NoFaceDev 2 жыл бұрын
Thank you man i was looking for this video
@dickypb7703
@dickypb7703 3 ай бұрын
Well explained, thanks man 💙
@jobsunday833
@jobsunday833 2 жыл бұрын
Thanks! I've been searching how to get it and this is brilliant :D
@matheusmartino5738
@matheusmartino5738 2 жыл бұрын
I will have to implament that next week at my job. Perfect timing. Thank you so much!
@amershboul9107
@amershboul9107 2 жыл бұрын
you deserve a huge like 👍🏻👍🏻
@krateskim4169
@krateskim4169 2 жыл бұрын
you are such a good teacher man
@thiagopintobraga6174
@thiagopintobraga6174 2 жыл бұрын
Great lesson, thank for sharing this. Tomorrow I will introduce this in some systems that Im building
@guidingtechbd
@guidingtechbd 2 жыл бұрын
Awesome explanation. I owe you!! 😊
@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
@moishinetzer
@moishinetzer 2 жыл бұрын
Stuff like this is awesome, I think your CSS stuff is good but this is what people really want!
@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
@lacamoura
@lacamoura 2 жыл бұрын
Yooo i needed this for my project, thanks a lot
@sandeeptottadi
@sandeeptottadi 2 жыл бұрын
Super exciting content!
@MdNaimurRahmanHera
@MdNaimurRahmanHera 2 жыл бұрын
Really learned some new things bro. Love you
@MoggersGG
@MoggersGG 2 жыл бұрын
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 :)
@zorogenius
@zorogenius Жыл бұрын
You earnt a subscribe, my friend.
@bobdinitto
@bobdinitto 2 жыл бұрын
Very, very awesome Kyle! I've always wondered how these notifications work. Thanks!
@LacMatMuaXuan
@LacMatMuaXuan 2 жыл бұрын
Thank you so much! Your clips are really useful for me and other people.
@zulhilmiomar1491
@zulhilmiomar1491 2 жыл бұрын
such a high value tutorial and info! thanks kyle!
@rulesofsuccessfullife6098
@rulesofsuccessfullife6098 11 ай бұрын
The video was helpful thank you for making me better than before
@mengsreangchannel6180
@mengsreangchannel6180 2 жыл бұрын
Thanks *Kyle* for sharing a good tutorial like this.
@GetushaHD
@GetushaHD 2 жыл бұрын
The COME BACK please is having me dead.😂
@Ahmedhkad
@Ahmedhkad 2 жыл бұрын
It's cool to try on the phone! For my own site notification
@nziokaaustin
@nziokaaustin 2 жыл бұрын
tutorial added to my "to try list" asap
@ohmwai
@ohmwai 2 жыл бұрын
Damn. I needed this like a week ago lol. But it's still a great learning experience.
@musha3368
@musha3368 2 жыл бұрын
Nice! Good job bro, best tutorials!
@BroScro
@BroScro 2 жыл бұрын
thank you kyle. how awesome is this!
@loordbeerus6284
@loordbeerus6284 2 жыл бұрын
You are awesome i love your content keep going ♥
@maxwellosuji4096
@maxwellosuji4096 2 жыл бұрын
I’ve been thinking of additional features to my website and this helps alot thanks kyle❤️
@kingstalker
@kingstalker 2 жыл бұрын
nice didin't expect that really good well done
@larrydev
@larrydev 2 жыл бұрын
I always wondered how this worked. Thanks!
@WebDevEducation
@WebDevEducation 2 жыл бұрын
Notification.requestPermission().then(perm => { if(perm === "granted"){ new Notification("Awesome tutorial!") } })
@beinyourguard
@beinyourguard 2 жыл бұрын
amazing! again, nice to see that JS is so powerful
@armageddonvivas9243
@armageddonvivas9243 2 жыл бұрын
ITS REALLY WORKED LOL THANK YOU DUDE
@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
@thefamousdjx
@thefamousdjx 2 жыл бұрын
Nice tutorial. I doubt many people actually grant that access. I always say NO when that popup shows
@Light_Of_Quran-Only_1
@Light_Of_Quran-Only_1 Ай бұрын
you have a great box of contents
@kuroexmachina
@kuroexmachina 2 жыл бұрын
always cool to see native stuff
@dclxviclan
@dclxviclan 2 жыл бұрын
New level knowledge, thanks bro 👍
@siya.abc123
@siya.abc123 2 жыл бұрын
Cheers for this tutorial man !
@akoladebode-ajayi327
@akoladebode-ajayi327 9 ай бұрын
Hi sir. Please why is that the modification method used in this video works for only PC and not in Android browsers
@tempaccount8256
@tempaccount8256 2 жыл бұрын
This is a very good tutorial for notification. I just wanted to have this kind of feature for my project. Thanks😁
@ArielZab
@ArielZab 2 жыл бұрын
Can you show us how to monitor ajax loading progress? So we can make something like a progress bar?
@pauserratgutierrez
@pauserratgutierrez 2 жыл бұрын
Wow, your knowledge is amazing. Thanks for all buddy!!
@rebarius
@rebarius 2 жыл бұрын
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.
@crkvend
@crkvend 2 жыл бұрын
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!
@isabelphillips451
@isabelphillips451 2 жыл бұрын
Wow! Thank you so much for this video ... I learnt a lot in one video 😍😍😍
@mentalites
@mentalites 2 жыл бұрын
I ca back to soft after about 10 years when I was using soft soft 10 and for its best program Ive seen in fact its also simpliest one
@darkmift
@darkmift 2 жыл бұрын
I'd like to see a video of your daily routine. Where you work etc.
@ridermonkyt
@ridermonkyt 2 жыл бұрын
Tag is the thing I learnt new.
@hackytech7494
@hackytech7494 2 жыл бұрын
Thanks a lot for this fantastic video. Best explanation ever.
@hawarhekmat1174
@hawarhekmat1174 2 жыл бұрын
Great video, for some reason i use firebase FCM
@lorenzomijorus
@lorenzomijorus 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)?
@amittraspal
@amittraspal 2 жыл бұрын
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.
@ilyesbejia6566
@ilyesbejia6566 2 жыл бұрын
Thanks for sharing those are great materials
@luis96xd
@luis96xd 2 жыл бұрын
Amazing tutorial, the best I've seen, it was well explained and in 11 minutes, thanks 👏💯👍😄👍
@youcefg9760
@youcefg9760 2 жыл бұрын
As a developer it's very interesting to know how to work with this Notifications API, and great tutorial by the way. But if you're a user web notifications are a nightmare, they're distracting, annoying and used for advertising, they can get very overwhelming if a user accepts every notification request from multiple sites, they should be disabled in most cases. How to disable them: In Chrome: Settings > Privacy and Security > Site Settings > Permissions > Notifications > Don't allow sites to send notifications. On Firefox: Type about:config on the address bar and press Enter > click "Accept the Risk and Continue" > type dom.webnotifications.enabled and set it to false.
@slametnugroho6535
@slametnugroho6535 2 жыл бұрын
wow, thank you so much, it was a big help
@nikhil6842
@nikhil6842 2 жыл бұрын
Great video Kyle
@sven_93
@sven_93 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
@sojumoscow
@sojumoscow 2 жыл бұрын
What did u do in "if" part of clearing interval, the auto closing of parenthesis?
@hikari1690
@hikari1690 2 жыл бұрын
Perfect! Now I can annoy people more jist for fun 🤣
@DarkOceanShark
@DarkOceanShark 2 жыл бұрын
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?
@tuomaskoivistoinen6476
@tuomaskoivistoinen6476 2 жыл бұрын
Identifier
@CMB696
@CMB696 Жыл бұрын
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;😐😩😔
@nielslytzdk
@nielslytzdk 2 жыл бұрын
You make killer content 👍. Good teacher too!
@colin-campbell
@colin-campbell 2 жыл бұрын
2:04 didn’t you do a video on why you should stop indenting code? ie that function should simply return if permission isn’t granted
@xBZZZZyt
@xBZZZZyt 2 жыл бұрын
10:28 can interval id (returned by setInterval) be 0? if check won't work then
@alexeyshaykov
@alexeyshaykov 2 жыл бұрын
Cool video Kyle. Can u pls create video about web push notifications? About Servise Workers and other thinks, that needs for webpush notifications? Interesting also how webpush notifications works in deeffrent browsers, especially in Safari
@24mjohnson
@24mjohnson 2 жыл бұрын
Im ciurious, Can something like this be done where it queries a database for tasks for specific users on each computer be it mac or pc and notifies them saying they have X number of tasks due at that time? It will run every so many minutes and query a database to find tasks in it that are active, for that specific user computer(however it can do that) and just pop up a notification of it?
@peberdah
@peberdah Жыл бұрын
Nice presentation, I wouldl like to use that mechanism to share clipboard content from Windows Pc to Android mobile and vice et versa.
@nottydread
@nottydread 2 жыл бұрын
Ooh, very interesting! Great tutorial.
@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?
@thedacian123
@thedacian123 2 жыл бұрын
Is it mandatoary that each time i want to raise a notification to request the rigth before.For instance i have a complex spa(react or angular).?Thank you!
@vmod3985
@vmod3985 2 жыл бұрын
Keep in mind that safari doesn't support this, add a check to see if "Notifications" exists before interacting with the API to avoid a crash on mobile
Every React Concept Explained in 12 Minutes
11:53
Code Bootcamp
Рет қаралды 877 М.
5 Must Know JavaScript Features That Almost Nobody Knows
18:06
Web Dev Simplified
Рет қаралды 478 М.
REAL or FAKE? #beatbox #tiktok
01:03
BeatboxJCOP
Рет қаралды 18 МЛН
When you have a very capricious child 😂😘👍
00:16
Like Asiya
Рет қаралды 18 МЛН
How I implement PWA push Notification
14:21
Daily Web Coding
Рет қаралды 13 М.
Learn JavaScript Touch Events In 17 Minutes
17:45
Web Dev Simplified
Рет қаралды 113 М.
Learn Debounce And Throttle In 16 Minutes
16:28
Web Dev Simplified
Рет қаралды 197 М.
Learn JavaScript Event Listeners In 18 Minutes
18:03
Web Dev Simplified
Рет қаралды 604 М.
Send and receive push messages - Progressive Web App Training
9:07
Chrome for Developers
Рет қаралды 99 М.
Speed Up Your React Apps With Code Splitting
16:50
Web Dev Simplified
Рет қаралды 396 М.
5 JavaScript Concepts You HAVE TO KNOW
9:38
James Q Quick
Рет қаралды 1,4 МЛН
Subtle, yet Beautiful Scroll Animations
5:04
Beyond Fireship
Рет қаралды 1,8 МЛН
REAL or FAKE? #beatbox #tiktok
01:03
BeatboxJCOP
Рет қаралды 18 МЛН