nativefier icon indicating copy to clipboard operation
nativefier copied to clipboard

Browser unsupported for push notifications on mobile.twitter.com

Open ronakg opened this issue 7 years ago • 28 comments

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

  1. login to the app using your Twitter credentials
  2. Click profile icon
  3. Go to Settings and Privacy -> Notifications -> Push Notifications
  4. Click Turn On.

Details

  • Are you nativefying a public website? : Yes
  • Feature request? Have you looked at nativefier --help to 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 avatar Jul 10 '18 21:07 ronakg

@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?

ronjouch avatar Jul 11 '18 03:07 ronjouch

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.

ronakg avatar Jul 11 '18 03:07 ronakg

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.

ronakg avatar Jul 11 '18 03:07 ronakg

The same as @ronakg has. I think its #88

alexey13 avatar Jul 27 '18 19:07 alexey13

Any update on this? I still can't get it to work.

BananaManCJ avatar Apr 29 '20 23:04 BananaManCJ

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?

ronjouch avatar Apr 29 '20 23:04 ronjouch

Notifications are still not working on Twitter

BananaManCJ avatar Apr 30 '20 19:04 BananaManCJ

Please read my above message. Thanks.

ronjouch avatar Apr 30 '20 19:04 ronjouch

I think the problem is with it authorizing notifications, notifications do work on http://www.bennish.net/web-notifications.html

BananaManCJ avatar Apr 30 '20 19:04 BananaManCJ

@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.

exander77 avatar Apr 30 '20 19:04 exander77

Oh, you have already tried bennish test side, then it is something strange in Twitter, will check.

exander77 avatar Apr 30 '20 19:04 exander77

I'm using the test build and the debugger is giving me no useful information

BananaManCJ avatar Apr 30 '20 19:04 BananaManCJ

Please read my above message. Thanks.

Oops, forgot to mention that I was using the test build and not the release

BananaManCJ avatar Apr 30 '20 19:04 BananaManCJ

@BananaManCJ How can I easily create a notification on Twitter?

exander77 avatar Apr 30 '20 19:04 exander77

@BananaManCJ How can I easily create a notification on Twitter?

What's your Twitter, I can try sending you a dm

BananaManCJ avatar Apr 30 '20 19:04 BananaManCJ

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?

exander77 avatar Apr 30 '20 19:04 exander77

I'm not entirely sure how it works, but you might be able to find a javascript file

BananaManCJ avatar Apr 30 '20 19:04 BananaManCJ

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

BananaManCJ avatar Apr 30 '20 20:04 BananaManCJ

I am also seeing that Twitter uses service workers for it's notifications

BananaManCJ avatar Apr 30 '20 20:04 BananaManCJ

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.

exander77 avatar Apr 30 '20 20:04 exander77

Yeah, I've seen that before, but I wasn't sure how to implement it.

BananaManCJ avatar Apr 30 '20 20:04 BananaManCJ

@exander77 You still planning on making a flag to disable and enable notifications?

BananaManCJ avatar May 07 '20 20:05 BananaManCJ

@BananaManCJ Yes, should go back to it. I was actually looking into those pushdown notifications, but it seems like quite complicated things.

exander77 avatar May 07 '20 20:05 exander77

I don't know if you saw this but there is a working example here

BananaManCJ avatar May 08 '20 19:05 BananaManCJ

Does Nativefier support service workers?

BananaManCJ avatar May 08 '20 19:05 BananaManCJ

@exander77 it's been over a month since a commit, are you still working on adding that cli flag?

BananaManCJ avatar May 29 '20 03:05 BananaManCJ

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 avatar Sep 28 '20 19:09 CoreyVidal

@CoreyVidal Twitter uses GCM for push notifications, which is not implemented in Electron at the moment.

BananaManCJ avatar Oct 14 '20 16:10 BananaManCJ