Bug 296242
Summary: | Declarative Web Push: local URLs are not supported | ||
---|---|---|---|
Product: | WebKit | Reporter: | sora |
Component: | WebKit Misc. | Assignee: | Nobody <webkit-unassigned> |
Status: | NEW | ||
Severity: | Normal | CC: | beidson, cdumez, webkit-bug-importer |
Priority: | P2 | Keywords: | InRadar |
Version: | Safari 18 | ||
Hardware: | Mac (Apple Silicon) | ||
OS: | macOS 15 |
sora
Declarative Web Push notifications works great, but the development experience can be gapped by not supporting localhost as part of URLs.
**Overview**
The implementation of Declarative Web Push has been straightforward, although with some trial and error, for our service-worker based Push API implementation.
We realized that relative paths are not accepted, probably because we're not operating in the service worker reign, so we switched to the full URL. Which works really well in regard to public URLs, but when it comes to local URLs they just get ignored.
**Steps to reproduce**
Send a Declarative JSON payload with localhost URLs
```
{
web_push: 8030,
notification: {
title,
body,
icon: 'http://localhost:3000/icon.png',
navigate: 'http://localhost:3000/notifications',
...options
}
}
```
**Actual results**
Push notification shows the default Safari icon and clicking on it just opens Safari
**Expected results**
Push notification shows the custom icon and clicking on it navigates to the URL.
**Additional information**
Sadly there's still not a central, consistent, source for this new specification, so there was a lot of trial and error. Following Apple's most recent guidelines there's not a mention of the requirements for URLs.
Relative paths, instead, cause the notifications to be completely dropped.
Attachments | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
Radar WebKit Bug Importer
<rdar://problem/156318816>