1

Everything was working fine until i had to update the app to have different name according to customers

Below is what i have done so far

generateManifest() {

return new Promise((resolve, reject) => {
  const urlParams = new URLSearchParams(window.location.search);
  const slug = urlParams.get('slug');
  const name = urlParams.get('name');
  localStorage.setItem('slug', slug);

  if (slug && name) {
    this.defaultManifest.name = name;
    this.defaultManifest.short_name = slug;
    this.defaultManifest.id = localStorage.getItem('slug');
    this.defaultManifest.icons = this.dynamicIcons;
    resolve(this.defaultManifest);
  } else {
    resolve(this.defaultManifest);
  }
})
.then((data: any) => {
  const manifestBlob = new Blob([JSON.stringify(data)], { type: 'application/manifest+json' });
  const manifestUrl = URL.createObjectURL(manifestBlob);
  const manifestLink = document.createElement('link');
  manifestLink.setAttribute('rel', 'manifest');
  manifestLink.setAttribute('id', 'my-dynamic-manifest');
  manifestLink.setAttribute('href', manifestUrl);
  // content type
  manifestLink.setAttribute('type', 'application/manifest+json');
  document.head.appendChild(manifestLink);
});}

This generates a manifest and links it to my index.html.

The manifest is created and i can see it in the application tab in chrome developer tools.

I also gets A2HS as an option in the chrome menu, but the prompt does not show like before

PS: this happens only on mobile devices, on desktop the prompt is shown

Exsite
  • 147
  • 3
  • 13

0 Answers0