ChemPal Documentation - v1.6.0
    Preparing search index...

    Function getInstallSource

    • Reports how the extension was installed, so callers know whether the browser will update it automatically.

      Returns InstallSource

      "webstore" when the browser manages updates, otherwise "manual".

      Detection reads chrome.runtime.getManifest().update_url, which the Chrome Web Store injects into the runtime manifest — our shipped manifest.json has no such key. This needs no permission, unlike chrome.management.getSelf().installType. Caveats:

      • Firefox never injects an update URL, so AMO installs report "manual" and take the GitHub path. Harmless: AMO auto-updates silently, so a newer release is normally only visible in the window between a GitHub release and AMO approval.
      • A future self-hosted CRX carrying its own update_url would be reported as "webstore".
      • Enterprise policy installs also carry an update_url and are correctly treated as auto-updating.
      getInstallSource(); // "manual" for an unpacked build loaded from dist/
      
      export function getInstallSource(): InstallSource {
      const manifest = chrome.runtime.getManifest();
      return 'update_url' in manifest && manifest.update_url ? 'webstore' : 'manual';
      }