I have a quick question.
I'm building a PWA with Polymer and Lighthouse reports, that the manifest's start_url
is not cached by the ServiceWorker.
Since I want to track the users, which use the 'Add to homescreen' function, my manifest.json contains
"start_url": "index.html?homescreen=1",
I tried putting this exact string into my sw-precache
config file, but the script generates a ServiceWorker, that just caches the index.html file.
(I'm aware, that it's a bit redundant to cache index.html & index.html?homescreen=1)
Do you have any idea, how to fix this behaviour?
Thanks!
The ignoreUrlParametersMatching
option is sw-precache
can help you here.
By default, it's set to [/^utm_/]
, meaning that if you configured your Web App Manifest like
{
"start_url": "index.html?utm_source=homescreen"
}
then things should work as expected. If you'd like to keep that ?homescreen=1
, then, when generating your service worker, you can change explicitly set the ignoreUrlParametersMatching
parameter to [/^homescreen/]
.