You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello! I noticed that when I click an FCM push notification, and there's already a tab open in the background, the browser just opens that tab, but contrary to what I expected, it does not redirect to the link I pass in fcmOptions.link. I looked into the SDK code, it looks like this:
const link = getLink(internalPayload);
// ...
let client = await getWindowClient(url);
if (!client) {
client = await self.clients.openWindow(link);
// Wait three seconds for the client to initialize and set up the message handler so that it
// can receive the message.
await sleep(3000);
} else {
client = await client.focus();
}
So the link is not used when the tab is already open in background. Would it makes sense to call client.navigate(link) in addition to focus()? Is there a way to do that without changing the SDK?
(I looked further in what happens with the event, and it's passed to the client, but the SDK only propagates PUSH_RECEIVED to onMessage, and leaves NOTIFICATION_CLICKED for other purposes.)
Alternatively, I'd be happy if I could just make it open a new tab every time.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello! I noticed that when I click an FCM push notification, and there's already a tab open in the background, the browser just opens that tab, but contrary to what I expected, it does not redirect to the link I pass in
fcmOptions.link
. I looked into the SDK code, it looks like this:So the link is not used when the tab is already open in background. Would it makes sense to call
client.navigate(link)
in addition tofocus()
? Is there a way to do that without changing the SDK?(I looked further in what happens with the event, and it's passed to the client, but the SDK only propagates
PUSH_RECEIVED
toonMessage
, and leavesNOTIFICATION_CLICKED
for other purposes.)Alternatively, I'd be happy if I could just make it open a new tab every time.
Beta Was this translation helpful? Give feedback.
All reactions