Skip to content

Instantly share code, notes, and snippets.

@zoepage
Last active June 13, 2019 13:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zoepage/3995803e624a6c24840966117a2a04ff to your computer and use it in GitHub Desktop.
Save zoepage/3995803e624a6c24840966117a2a04ff to your computer and use it in GitHub Desktop.
required keys for A2HS + possible validation

can display manifest

  • Check for manifest.json or .webmanifest (if served by correct type)

A2HS

  • Check for HTTPs
  • (maybe check if SW is registered, not required tho)
  • check for reqired keys for A2HS
    • background_color
    • display
    • icon (size, src, type)
    • start_url
    • name / short_name

Suggestion for best practice of keys

  • name: length of String (if too long, recomment also adding short_name which will be then used on home screen, launcher etc)
  • short_name: recomment also using name as this one is displayed in the install prompt and might be easier to understand
  • icons: 1 needed including src, size & type (object pattern matching), size of icon should be devidable by 48. Check for type.
  • background_color: maybe check for color + bg_color contrast, check if value is correct(hex, rgb, rgba)
  • theme_color: same as bg_color
  • display: 4 values allowed (fullscreen, standalone, minimal_UI, browser), pattern matching as validation. We should check for restrictions later on for every value.
  • description: length?

validation of values

https://searchfox.org/mozilla-central/source/dom/manifest/ValueExtractor.jsm#48,62 (color + language)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment