PWA (Progressive Web App)
nitaaikumar I'm asking the same, I've made my own PWA a few days before this extension.
nitaaikumar It’s not much different than that. Although this extension’s service worker includes a very basic offline page too. Which you could also do yourself manually.
This extension is for someone who doesn’t want to have to add the code that goes in the site’s head. Or doesn’t know how. And also, it gives you a complete manifest and service worker file.
In other words, if you don’t know how to make your Flarum site a progressive web app but you want it to be one, you could use this extension.
I just witnessed the cached offline page which comes with this extension work in the wild for the first time. My Internet connection temporarily stopped working and sure enough, when I refreshed the page at my forum, instead of getting a default browser connection error page, I got the PWA offline cached page. Which is kind of nice.
Now, the offline page that comes with this extension is extremely minimal. If you're pretty good with HTML/CSS/JavaScript you can edit the offline.html file that comes with this extension and make something extravagant if you wanted to. Maybe a fun little game for users to play while their Internet, or the site, is down.
[deleted]
010101 One thing I've noticed is that even with the extension disabled, I witnessed a variety of odd caching issues. I deleted the 2 files from the root, and now the problem with caching has gone.
Something to be aware of.
[deleted]
010101 I'm fairly sure I had the most up to date version
- Edited
[deleted] You could have had old cached files in your browser from a previous version. After switching versions I had to go into my chrome dev console and clear cookies and cache, from the application tab. There’s also a spot to clear the manifest that it has stored. I noticed the standard browser cache clear sometimes wasn’t quite doing it. Plus, if you use Cloudflare that’s of course another culprit.
I just know that the latest version doesn’t cache (unfortunately, I actually wish it did) and so it seems like a coincidence that removing the files fixed something related to caching.
But, who knows. I’ve heard of weirder things happening. It seems like sometimes each server or hosting set up can treat things differently.
this extension + webpush notifications is so beautiful <3
Thank you.
Can we generate PWA via usin https://www.pwabuilder.com/generate website for Flarum?
fakruzaruret Yes, that is what I used for this extension. The main thing this extension does is it ensures that the appropriate code gets called in the head of your site. But, you could use a generator like the one you are pointing out, create the necessary files, and do it that way. As long as you know how to call the files from your Flarum's head. If you don't know how, here you go: https://discuss.flarum.org/d/20162-how-to-add-to-head-head
010101 yes calling files from head is difficult for me Thank you very much.
Hi there
I really want (my users too ) this working. Thanks for the extension.
As thedd
I added sw.js and site.webmanifest files to flarum root folder
-paste the code to sw.js
-and the code to site.webmanifest
and installed the extension composer require zerosonesfun/pwa
clear flarum cache, clear Safari iOS cache
And I have ssl activated
But when I add the website from safari to the homescreen, I just get a weblink to the site in safari.
I don't know where could be the issue
Just one thing, flarum is installed in a subdirectory on mywebsite https://lafabriq.org/forum and that's where I put the files.
Thanks for your help
Th0mC Try this:
Open the site.webmanifest file and change the start_url and scope like so:
"start_url": "/forum/",
"scope" : "/forum/",
I can see after visiting your site that your site.webmanifest file is not being detected properly. By default the code that goes with this extension is set up to work best when your Flarum installation is installed at your site's root. But, this change will hopefully fix it.
After you make this change clear all caches; flarum's and your browser.
- Edited
Th0mC It must be due to your set up. I see when you go to your main domain, it redirects to /forum. Maybe the manifest and sw.js needs to be moved to your main public root. Not in the /forum directory. And also revert the above changes. Put the start url and scope back to just “/.”
Another possibility is, I remember when troubleshooting this extension in the past, it takes a lot to clear all cached data. Just clearing the main browser cache might not be enough. I had to go into the Chrome dev console and actually delete things from the application tab. That’s if you are using Chrome. Long story short there are many things which could be causing this.
If you continue to not have success you may need to find a developer who is well versed in PWA. This extension works with a basic set up where the forum is served from the public root.