Skip to content

FR: Focus tab of the same origin (but not with the same url) #390

@Oupsla

Description

@Oupsla

[REQUIRED] Describe your environment

  • Operating System version: Ubuntu 16.04 / Chrome 63 / Node 8.9
  • Firebase SDK version: 4.8.1
  • Firebase Product: messaging

[REQUIRED] Describe the problem

When receiving a push message with a click_action in the notification payload, the service-worker tries to find a tab with the same url than the click_action.

If it succeeds, the service worker focus this tab.
If it fails, the service worker opens a new tab (or window).

But the url of the tab has to be exactly the same url than the click_action.
If a tab with the same origin than the click_action but with a different url (a different page, for my case in a one page application with Polymer) is found, the service worker will open a new tab instead of focusing this tab and send a message to it (to tell the application to change the page for example).

Steps to reproduce:

  1. Integrate the firebase-js-sdk into an application
    1.b. Navigate into the application
  2. Send a push notification to a client (with a click_action in the payload)
  3. Click on this notification
  4. See that will open a new tab (or window)

Relevant code :

Example

Notification payload:
{ notification: { 'title': 'Title', 'body': 'Message body', 'click_action': 'https://example.firebaseapp.com/demo/commands/' } }
Url of the inactive tab : https://example.firebaseapp.com/demo

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions