Browser unsupported for push notifications on mobile.twitter.com
Description
I created an app for mobile.twitter.com. When I visit Settings -> Push Notifications -> Enable, it says that the browser is not supported.
Steps to reproduce issue
$ nativefier --name Twitter --counter --max-width 600 -f --single-instance mobile.twitter.com
- login to the app using your Twitter credentials
- Click profile icon
- Go to Settings and Privacy -> Notifications -> Push Notifications
- Click Turn On.
Details
- Are you nativefying a public website? :
Yes - Feature request? Have you looked at
nativefier --helpto see if an existing option could fit your needs?: Yes - Full nativefier command used to build your app:
nativefier --name Twitter --counter --max-width 600 -f --single-instance mobile.twitter.com - Version of Nativefier (run
nativefier --version):v7.6.4 - Version of node.js (run
node --version):v5.12.0 - OS:
MacOS 10.13.5 - Error message / stack trace (if any):
None
Screenshot of the error message: https://imgur.com/gLTMSTa
@ronakg thanks for the feedback. Can you try checking what the reported User Agent is (pop up the DevTools, then evaluate navigator.userAgent) and spoof it to a regular browser one via the --user-agent flag?
navigator.userAgent is set to Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36.
I've already tried setting --user-agent 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36', which didn't help.
On the regular browser window, I get a pop-up asking if the website should be allowed to send notifications. That window is not showing up for the nativefier app.
The same as @ronakg has. I think its #88
Any update on this? I still can't get it to work.
Any update on this? I still can't get it to work.
@BananaManCJ oh hey, thanks, this issue is a dup of https://github.com/jiahaog/nativefier/issues/88 . Notifications were broken but fixed by @exander77 in 1d3bed5f09961e878c4c40085bd69aa2159d3a4c, but this is unreleased yet, as I'm waiting on one thing (see below). If you really cannot wait, install a dev. build, where notifications should work.
@exander77, you said you'd add a flag to enable/disable notifications, and keep the current default to disabled notifications, as doing the contrary would be breaking current behavior established since 2016. Are you still progressing on this?
Notifications are still not working on Twitter
Please read my above message. Thanks.
I think the problem is with it authorizing notifications, notifications do work on http://www.bennish.net/web-notifications.html
@BananaManCJ Can you verify this page? https://www.bennish.net/web-notifications.html If it works ok, then I will investigate what is going on in Twitter. If it does not work, then there is something strange on your end, like not actually using the dev build.
Oh, you have already tried bennish test side, then it is something strange in Twitter, will check.
I'm using the test build and the debugger is giving me no useful information
Please read my above message. Thanks.
Oops, forgot to mention that I was using the test build and not the release
@BananaManCJ How can I easily create a notification on Twitter?
@BananaManCJ How can I easily create a notification on Twitter?
What's your Twitter, I can try sending you a dm
Hmm, seems like "push notifications" are not standard "notifications", it is something different for mobile devices. Can you please elaborate for me how it actually differs from normal notifications?
I'm not entirely sure how it works, but you might be able to find a javascript file
https://abs.twimg.com/responsive-web/web/bundle.Notifications.0e522c64.js https://abs.twimg.com/responsive-web/web/bundle.NotificationDetail.24bb4ac4.js https://abs.twimg.com/responsive-web/web/loader.PushNotificationsPrompt.660083f4.js
Got these from https://mobile.twitter.com/sw.js
I am also seeing that Twitter uses service workers for it's notifications
This will need a more in-depth analysis, Push Notifications seems to be initially supported on mobile devices, but now are also available in Desktop browsers. It is a completely different API from normal Notifications.
There seems to be recent work on this module: https://github.com/MatthieuLemoine/electron-push-receiver For Electron, but I am not sure what is a state of it.
Yeah, I've seen that before, but I wasn't sure how to implement it.
@exander77 You still planning on making a flag to disable and enable notifications?
@BananaManCJ Yes, should go back to it. I was actually looking into those pushdown notifications, but it seems like quite complicated things.
I don't know if you saw this but there is a working example here
Does Nativefier support service workers?
@exander77 it's been over a month since a commit, are you still working on adding that cli flag?
Has this been resolved? I'm trying twitter.com and it's not allowing me to enable notifications.
nativefier --name Twitter --single-instance --tray start-in-tray --show-menu-bar --verbose "https://twitter.com" "C:\Program Files\Nativefier"
@CoreyVidal Twitter uses GCM for push notifications, which is not implemented in Electron at the moment.