[PWA widgets] Add documentation about options to update widgets more than once a day
There are no noted restrictions about the update time. It kinda suggest the update time can be anything but everything below the values used in the doc (86.400) wont work
Document Details
⚠ Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.
- ID: 1a0e6a65-5e0a-55cc-d3c8-b4fdd37a2d2b
- Version Independent ID: 1a0e6a65-5e0a-55cc-d3c8-b4fdd37a2d2b
- Content: Build PWA-driven widgets - Microsoft Edge Development
- Content Source: microsoft-edge/progressive-web-apps-chromium/how-to/widgets.md
- Product: microsoft-edge
- Technology: pwa
- GitHub Login: @MSEdgeTeam
- Microsoft Alias: msedgedevrel
AB#48547685
Thanks a lot for this issue. Can you say a little more about what happens when you choose a value that's less than 86400? What doesn't work exactly? Does the widget not get registered? Something else?
@captainbrosset the docs inspired me to built a widget with PWA that shows your agenda from multiple accounts. The ease of using web technolgy and still be able to have full functionality was attractive.
Now I built the widget I learned service workers come with many limitations. The number of invocation of your serviceworker depend on the use of your app but will never be less then once a day (86400); using a update value like 3600 (every hour) will be still once a day, in best case, as many depends on your side engagement score which can be see here in edge: about://site-engagement/
Personally I think if your widget is depended on this, PWA doesnt make sense, Your widget needs to be useful (https://learn.microsoft.com/en-us/windows/apps/design/widgets/) and showing information that is 24 hours makes it useles for many cases
Fair point. I'm going to discuss about this with the engineering team who knows best about service workers and widgets and we'll get back to you.
Here are two options to update your widget:
- Send Push messages from your server to your service worker, to "wake it up", and use this update your widget.
- Use widget events like
widgetclickandwidgetresume. Forwidgetclick, this would require the user to click on a refresh button in the widget. Forwidgetresume, I'm not entirely sure when the Windows Widgets board resumes widgets, but it might be worth a shot. I'll try to find out more.
Do these help?
I am going to search about widgetresume. Thanks for the pointer!
Send push notifications isn't a option, well gives another challenge. Push Notification are required to use showNotification resuling in a toast banner. I see instagram doing it; but its annoying as hell. (https://web.dev/articles/push-notifications-handling-messages ) ; I am not reallt able to find any docs about edge specifics. So maybe edge is handling this different?
Alternative i was checking was to use WinAppSdk for a full native app and use WinRT background tasks which allows me to update each 15 minutes (https://learn.microsoft.com/en-us/uwp/api/windows.applicationmodel.background.timetrigger.freshnesstime?view=winrt-22621)
But given de effort i Did moving to native is bit waste of time
widget resume seems to work pretty nicely. Thanks!
Push Notification are required to use showNotification resuling in a toast banner
Correct, silent push notifications are currently not supported by browsers, at least by Chrome and Edge.
widget resume seems to work pretty nicely. Thanks!
Oh great! Glad this is working for you. I'll add this issue to our backlog and use it to update the docs to mention how to update widgets more than once a day.