谷歌浏览器(Google Chrome)终于开始打击滥用推送通知的网站。TheWindowsClub获悉,Chrome 正在chrome://flags后面添加一个新功能#Push-Subscription-With-Expiration-Time ,它将推送通知订阅限制为 90 天。此标志将使推送(Push)订阅(Subscriptions)支持过期时间。

Chrome解决通知滥用问题
在撰写本文时,此标志在更新的Chrome Canary中不可用。但根据Chromium Gerrit提交,它已成功重新定位并提交到更新的Google Chrome Canary 86。也许这项工作仍在进行中,我们可以期待这个实验性功能标志将在未来几天内实施到未来的 Chrome Canary 版本中(future Chrome Canary builds in the coming days)。
“This CL enables Push Subscriptions to support a expiration time, set by Chrome in push_messaging_constants.h (currently 90 days),” the description reads.
“This feature is disabled by default, so to try it out you must set –enable-features= PushSubscriptionWithExpirationTime.”
根据Chromium开发人员的说法,这将在订阅推送通知和订阅方法本身时增加过期时间(90 天)。此特定功能将通过过期时间属性闪烁。
“expirationTime 属性将通过推送服务生成。在SubscriptionCallback中取回时(null 有效),需要向下传递给 blink 层。”

Chrome可能会实施某些 UI 更改,以提示用户将其推送通知订阅设置为在特定时间段后过期。用户是否可以自定义时间范围还有待观察。首先(First),当第一次订阅推送通知时,这个功能看起来会清楚地传达订阅到期。
整个过程涉及多方。用户订阅通知后,将从app_identifier(app_identifier)检索有关订阅到期的信息,并将其作为回调发送回PushMessagingManager。Chrome会将过期时间存储在PushMessagingAppIdentifier中。但是,这尚未实施。也就是说,此功能正在积极开发中。
一旦此标志可用,您就可以在Google Chrome Canary上启用它。
如何在Chrome中启用带有过期时间(Expiration Time)标志的推送订阅(Push Subscription)
- 打开 Chrome 金丝雀
- 打开chrome://flags
- (Locate Push Subscription)找到具有到期时间(Expiration Time)的推送订阅
- (Set)使用下拉菜单将标签设置为在隐藏选项卡时立即启用(Enable)
- 重新启动 Chrome。
总而言之,此功能将在订阅通知时添加订阅到期。同时,Chrome必须在用户代理端决定在哪里保存过期时间。好吧,这个功能是可选的,由用户决定他们是否希望他们的推送订阅在 90 天后过期。
自上个月以来,Chromium 开发人员一直在积极开发此功能。TheWindowsClub发现了几个确认开发的Chromium Gerrit提交。(Chromium Gerrit)
chrome://flags下提供此实验性功能标志#Push-Subscription-With-Expiration-Time后立即更新本文。
Google Chrome to limit push notification subscriptions to 90 days
Google Chrome is finally cracking down on webѕites abusing push notifications. Chrome is adding a new feature #Push-Subscription-With-Expiration-Time behind chrome://flags that will limit push notification subscriptions to 90 days, TheWindowsClub has learned. This flag will enable Push Subscriptions to support an expiration time.

Chrome addressing notifications abuse
At the time of writing this article, this flag is not available in the updated Chrome Canary. But as per Chromium Gerrit commit, it has been successfully rebased and submitted to the updated Google Chrome Canary 86. Perhaps the work is still in progress and we can expect this experimental feature flag to be implemented to future Chrome Canary builds in the coming days.
“This CL enables Push Subscriptions to support a expiration time, set by Chrome in push_messaging_constants.h (currently 90 days),” the description reads.
“This feature is disabled by default, so to try it out you must set –enable-features= PushSubscriptionWithExpirationTime.”
According to Chromium developers, this will add expiration time (90 days) when subscribing to push notifications and in the subscribe method itself. This particular feature will Pass expiration time attribute to blink.
“The expirationTime attribute will be generated through the push service. When getting it back in the SubscriptionCallback (null is valid), it needs to be passed down to the blink layer.”

Chrome is likely to implement certain UI changes that will prompt users to set their push notification subscription to expire after a specific period. It remains to be seen whether or not users can customize the time frame. First things first, it looks like this feature will clearly communicate subscription expiry when push notifications are subscribed for the first time.
There are several parties involved in the entire process. Once users subscribe to notifications, information about subscription expiry will be retrieved from the app_identifier and sent back as a callback to PushMessagingManager. Chrome will store expiration time in PushMessagingAppIdentifier. However, this has not been implemented yet. That said, this feature is actively under development.
Once this flag is available, you can enable it on Google Chrome Canary.
How to enable the Push Subscription With Expiration Time flag in Chrome
- Open Chrome Canary
- Open chrome://flags
- Locate Push Subscription With Expiration Time
- Set the flag to Enable immediately when a tab is hidden using the drop-down menu
- Relaunch Chrome.
To summarize, this feature will add expiry to subscriptions at the time of subscribing to notifications. Meanwhile, Chrome has to decide where to save expiration time on the user agent side. Well, this feature will be optional and it will be up to users to decide whether or not they want their push subscriptions to expire after 90 days.
Chromium developers have been actively working on this feature since last month. TheWindowsClub has spotted several Chromium Gerrit commits that confirm the development.
We will update this article as soon as this experimental feature flag #Push-Subscription-With-Expiration-Time is available under chrome://flags.