How can I know if my Safari extension code is running for the first time after the user has installed the extension?
I would like to differentiate between a new installation of the extension vs. an update of the extension.
I am looking for something very similar to this answer, but for Safari, instead of for Chrome. I haven't been able to "translate" the code from the answer in that link to Safari.
If you can live without the update check, this script should work (compare with the Chrome related answer):
If you want to check for updates also, you need to asynchronously get the version from the plist file, as so:
Took @Claudijo's answer above and worked it into a small class:
we can get version from safari.extension.displayVersion
do not forget to add hidden setting item in Extension Builder