Adding PWA to existing application



I have downloaded a PWA sample (WisejPWAWebApplication1) from the forum and it worked perfectly:

I am now trying to turn a solution that wasn’t been created with the PWA Template into a PWA allowed application.

I have copied the Offline folder to my application folder.

Copied the manifest.json to the same folder.

Edited my Default.json and added:

	"enablePWA": true,
	"offlineUrl": "Offline/Default.html",

Edited my Default.html and added (didn’t type the “less than” and “greater than” signs bellow as it keeps the line from displaying here):

    link rel="manifest" href="manifest.json"

In my Program.cs:
In Main():

            Application.BeforeInstallPrompt += Application_BeforeInstallPrompt;

Also in Program.cs:

        private static void Application_BeforeInstallPrompt(object sender, EventArgs e)
            Application.BeforeInstallPrompt -= Application_BeforeInstallPrompt;

However, Application_BeforeInstallPrompt is never called and I also don’t get the indicator in the Chrome browser Navigation bar allowing to “Install App”. This all works fine in the sample when I run it.
When I run my application, I open the browser Console and can’t see any complaints there.

Would there be anything else I should pay attention to?

Thanks in advance.

(Wisej – VS 2019 – C#)

  • You must to post comments
Best Answer

Hi Ivan

Thanks very much for sharing your solution 🙂

Regards and happy coding

  • You must to post comments

Found it! 🙂

In the application Web.config, there was an entry for the handlers:

      add name="json" verb="*" path="*.json" type="System.Web.HttpForbiddenHandler"/

In the working sample, instead of seting to all .json files, it states only Default.json. So, changing the Web.config like bellow fixed it:

      add name="json" verb="*" path="Default.json" type="System.Web.HttpForbiddenHandler"/
  • You must to post comments

I went ahead and called from my application menu: this.Eval(“Wisej.showPWAPrompt()”);

Got an error in the browser Console:
Failed to load resource: the server responded with a status of 403 (Forbidden) manifest.json:1

  • You must to post comments
Showing 3 results
Your Answer

Please first to submit.