Application Version Number on Browsers for Ionic Apss


I was looking to get the version number for my Ionic project within a browser.

Given that Ionic is going the PWA route, has anyone thought of a clean way to get the Application Version Number for the browser?

I have seen responses for the cordova plugins(which obviously don’t work on the browser) but even the method of adding a version number to the index.html to use meta to get it later on seems very hacky and not clean.

Does anyone have any inputs on this problem or how they have handled it?

Thank you.

Is there something wrong with changing a constant every time you push? If you’re asking if it’s possible to read from package.json, the answer is yes. But you might not want to be able to for security reasons.

Hi @AaronSterling

thanks for your reply.

I don’t think there is anything wrong with changing a constant every time we push but it seems to me that is quite a work around for achieving very little.

You also did mention possible ways to read package.json and changing constants. Are you referring to the same thing as using say a grunt task to read from the xml file to replace the meta in the index.html or do you have references for some other ways as well?

Can we even integrate these tasks with the automated build process for Ionic Pro(that uses webpack)?