How does Facebook send notifications without tab - html

Go to facebook and allow HTML5 Desktop Notification for it.
Close facebook tab.
Ask somebody to write you message on facebook.
Now u see the notification from facebook while facebook site isn't open. HOW?

Facebook uses the Push Notifications API: https://www.w3.org/TR/push-api/
More information:
https://developers.google.com/web/fundamentals/push-notifications/
https://developers.google.com/web/fundamentals/getting-started/push-notifications/

They use the Push API - https://developer.mozilla.org/en-US/docs/Web/API/Push_API
Quoting from there:
The Push API gives web applications the ability to receive messages
pushed to them from a server, whether or not the web app is in the
foreground, or even currently loaded, on a user agent.

Related

Best way to send push notifications from the server to a chrome extension?

I'm making a chrome extension for a classified ads website. With the chrome extension users will be able to get latest lists from their watched categories/search query.
I am already working on a websocket server to send notifications to users, but this way I have to always have a socket connection open to every user.
My second approach was to use Firebase, but this will run the notification only when a user clicks the icon (as I've read), and I would rather have this done from my server
__
Are there any other possible solutions to send notifications to a chrome extension without the user clicking on the icon?
You can use Google's push infrastructure ― the very same that powers Android push notifications ― Google Cloud Messaging.
Note: Firebase Cloud Messaging is presented as an upgraded version of GCM; while true, it's not natively supported by Chrome in a way that GCM is.
chrome.gcm API is the one that works with it. See its documentation, as well as GCM documentation, for details.
There's even a tutorial: Implementing GCM Client on Chrome
But in a nutshell, your extension will register as a subscriber with GCM, pass the subscription ID to the server, and then the application server posts messages to GCM using those IDs.
You should also be able to use Firebase, if you're willing to implement it using the generic JS SDK; "this will run the notification only when a user clicks the icon" sounds pretty nonsensical ― a background page should be able to keep a listener alive and react, which is probably how your system works now. I would still recommend a native API, which should be compatible with Event pages.
Have you looked at the chrome.notifications API? It allows you to create rich notifications using templates and show these notifications to users in the system tray.
https://developer.chrome.com/apps/notifications
You can have a connection to your socket server in the background script, listen for messages from your socket server and trigger an event that shows the notification.

Showing unread notification count through web manifest

I recently added a web manifest to my webapp following this guide. It works perfectly fine. I have also implemented push notifications. I want to know if there is a way to add an unread notification count like any other android app does indicating number of unread notifications on the launcher icon on the homescreen.
The WICG Badging API will most likely solve this, but it will take some time before browser implement it.
See https://github.com/WICG/badging/blob/master/explainer.md

Can you write an extension into the email / messaging app?

Is it possible to "plug-in" or create an extension to the email app on Windows Phone? The way the user would interact with it is that during the creation or reading of a message my tool would be another option on the New or Read message command bar? Essentially I would like to extend the functionality of the mail app. I don't see any other way at this point other than creating a brand new email application for the phone.
No. The best you can do is to use the share contract in your application and send some information to the Email app. Once it opens up, you won't be able to "plug" any behavior.
Have a look in this and this MSDN articles.

Box OAuth2 Authorization on Android

Firstly any news on the V2 SDKs for iOS and Android?
The normal flow is:
In app: click authorize button.
browser opens box.com/api/oauth2/authorize?....
User inputs their details.
User is taken to an allow/deny page.
User taps allow or deny.
User is taken back to app via the redirect_uri scheme.
My problem is once the user has put their details (3) in once and arrived at the allow/deny page, any future attempts to authorize full on skip the allow/deny page and go straight to the box home page without ever calling the redirect_uri along with the auth codes.
This can be 'fixed' if the user clears their browsing history/cookies before trying again, which is a long way from ideal. Any ideas?
For a potential short term fix until the v2 sdk is released, a web view can be used which will give you full control over things like the cache (we are using one in the sdk).

Google Chrome plug in to read saved cookies

I'm new to Google Chrome plug in development. I have learnt how to develop a basic plug in. Now the problem is I'm trying to make a plug in that can read saved cookies of a particular website you visit.
For instance, a user visits www.facebook.com, after login he will click on our plug-in icon and a drop down window will appear and show all the cookies saved by Facebook.
Here I want to ask how to read the cookies of the site you are visiting? Is that possible to sort cookies with respect to site you visit?
If yes? Can you provide me a reference of how it could be done?
There is a Cookies API that allows Chrome extensions to access the browser's cookies, without having to send HTTP requests to obtain those cookies. More references
This thread might also be helpful.