Before a PWA Release: Check Every Icon URL in Your Web App Manifest

Check PWA manifest icon URLs before release: resolve paths, inspect redirects and image dimensions, and verify installed icons in target browsers.

Published
Reading time
7 min read
Before a PWA Release: Check Every Icon URL in Your Web App Manifest
On this page

A manifest can load successfully while one or more of its icons fail to load, decode, or match their declarations. This checklist explains how to check PWA manifest icon URLs before a release, from resolving relative paths to inspecting the installed app in your target browsers.

Key Takeaways

  • Resolve each icon’s src against the manifest URL, not the page URL.
  • Check the final resource after redirects, including its image format and actual dimensions.
  • An HTTP success response does not prove that a browser can decode, select, or display an icon.
  • Test installation and icon display on the browsers and platforms you support, including with your production service worker active.

Research and testing limitation: The manifest specification and browser documentation were not available to consult for this article. The example has not been executed, and current browser behavior has not been verified here. Check the specification and documentation for your supported browser versions, and complete the release tests below before publishing.

1. Find the manifest and resolve every icon URL

Open the production page and identify its manifest link. In browser developer tools, use the network panel to find the manifest request and its final URL after any redirect. Inspect the response body and its icons array.

Each icon’s src is resolved relative to the manifest’s location. For example, given a manifest at https://example.com/releases/manifest.webmanifest:

Icon srcResolved URL
icons/app.pnghttps://example.com/releases/icons/app.png
../icons/app.pnghttps://example.com/icons/app.png
/icons/app.pnghttps://example.com/icons/app.png

If your manifest moves into a versioned directory, relative icon paths can change even when the page URL stays the same. Check query strings and absolute URLs too; don’t assume every entry uses the same host.

Advertisement

2. Check the response and the image

For every icon entry, record its declared src, sizes, type, and, if present, purpose. Then inspect the resolved resource:

  • Missing file: Confirm the final request succeeds. A missing icon might return a 404, or a server might return an HTML fallback page with a successful status instead.
  • Redirects: Follow the full chain in the network panel. Confirm the final URL is intentional and the browser can fetch it in the production environment.
  • Format: Confirm the response is an image in the intended format. Compare the actual image format with the manifest’s type, if declared, and the response’s Content-Type. A file extension alone is not proof of its contents.
  • Dimensions: Compare the decoded dimensions with the sizes declaration. Investigate incorrect declarations and entries with no declared size.
  • Purpose: Check that each icon has the purpose you intend, such as any, maskable, or monochrome. Verify the artwork visually for each intended use; loading a file does not prove it will look right when masked or rendered as a monochrome icon.

Treat sizes: "any", vector images, and multi-image formats as special cases: a single raster width-and-height comparison does not establish whether they are suitable. Test them in the target browsers and inspect their contents with an appropriate image tool.

3. Run a raster-icon preflight

The following script is a preflight, not a browser emulator. It fetches a manifest, resolves icon URLs against its final response URL, follows redirects, and checks PNG, JPEG, and WebP images with Pillow. It reports unsupported formats for manual inspection. It does not verify browser selection, rendering, every redirect hop, or multi-image formats.

Prerequisites: Python and Pillow. Save the script as check_icons.py, install Pillow with python -m pip install Pillow, and run it against a manifest URL you control:

python check_icons.py https://example.com/manifest.webmanifest

Replace the example URL with your own. Run the script only on trusted URLs in an appropriate environment: it follows redirects and does not implement the network restrictions needed for a public URL-fetching service. Its URL resolution is a Python preflight; confirm the effective requests in a browser too.

import io
import json
import re
import sys
from urllib.parse import urljoin, urlparse
from urllib.request import urlopen

from PIL import Image

MAX_BYTES = 10 * 1024 * 1024
FORMATS = {
    "PNG": "image/png",
    "JPEG": "image/jpeg",
    "WEBP": "image/webp",
}


def fetch(url):
    if urlparse(url).scheme not in ("http", "https"):
        raise ValueError("Only HTTP and HTTPS URLs are supported")
    with urlopen(url, timeout=15) as response:
        data = response.read(MAX_BYTES + 1)
        if len(data) > MAX_BYTES:
            raise ValueError("Response exceeds the preflight size limit")
        return data, response.geturl(), response.headers.get_content_type()


def main(manifest_url):
    data, base_url, _ = fetch(manifest_url)
    manifest = json.loads(data)
    icons = manifest.get("icons")
    if not isinstance(icons, list) or not icons:
        raise ValueError("Manifest has no non-empty icons array")

    issues = 0
    for index, icon in enumerate(icons, start=1):
        print(f"Icon {index}:")
        try:
            if not isinstance(icon, dict) or not isinstance(icon.get("src"), str) or not icon["src"]:
                raise ValueError("Missing or invalid src")
            requested = urljoin(base_url, icon["src"])
            image_data, final_url, content_type = fetch(requested)
            print(f"  Requested: {requested}")
            print(f"  Final: {final_url}")

            with Image.open(io.BytesIO(image_data)) as image:
                actual_type = FORMATS.get(image.format)
                if actual_type is None:
                    raise ValueError(f"Format {image.format!r} needs manual inspection")
                image.load()
                width, height = image.size

            print(f"  Decoded: {actual_type}, {width}x{height}")
            declared_type = icon.get("type")
            if declared_type and declared_type.lower() != actual_type:
                print(f"  ISSUE: declared type is {declared_type!r}")
                issues += 1
            if content_type.lower() != actual_type:
                print(f"  ISSUE: response Content-Type is {content_type!r}")
                issues += 1

            sizes = icon.get("sizes", "")
            if not isinstance(sizes, str):
                raise ValueError("Invalid sizes declaration")
            if not sizes.strip():
                print("  ISSUE: no sizes declared; review manually")
                issues += 1
            for token in sizes.split():
                if token.lower() == "any":
                    print("  ISSUE: 'any' requires manual review")
                    issues += 1
                    continue
                match = re.fullmatch(r"([0-9]+)[xX]([0-9]+)", token)
                if not match or (int(match.group(1)), int(match.group(2))) != (width, height):
                    print(f"  ISSUE: size {token!r} does not match decoded dimensions")
                    issues += 1
        except Exception as exc:
            print(f"  ISSUE: {exc}")
            issues += 1

    if issues:
        print(f"Review required: {issues} issue(s).")
        return 1
    print("Preflight complete; browser testing is still required.")
    return 0


if __name__ == "__main__":
    if len(sys.argv) != 2:
        print("Usage: python check_icons.py MANIFEST_URL", file=sys.stderr)
        sys.exit(2)
    try:
        sys.exit(main(sys.argv[1]))
    except (OSError, ValueError, TypeError) as exc:
        print(f"Manifest check failed: {exc}", file=sys.stderr)
        sys.exit(1)

A failure or unsupported format requires investigation; it does not by itself establish how every browser will behave. Conversely, a clean preflight only establishes that these checks found no issues. Pillow’s ability to decode a format can also depend on its installation.

Advertisement

4. Verify the release in target browsers

Use a release candidate deployed at its real public origin. Repeat this checklist for each supported browser, operating system, and relevant device class:

  1. Open the page with developer tools and confirm that the intended manifest loads. Inspect manifest-related warnings and the parsed icon entries where the browser exposes them.
  2. Inspect icon requests in the network panel, including redirects, final response status, response type, and any blocked requests. A cross-origin manifest or icon can introduce additional browser or deployment constraints; investigate browser console and network errors rather than assuming the request is usable.
  3. Exercise the supported installation or add-to-home-screen flow. Check the icon in the resulting surface, and check other relevant surfaces such as an app launcher or splash screen where the platform provides one.
  4. Inspect maskable and monochrome artwork in the contexts where your target platforms use it. Look for clipping, poor contrast, or an unexpected fallback icon.
  5. Repeat with the production service worker active. Check whether cached manifest or icon responses differ from the deployed files, and test the update path from an existing installation as well as a fresh one.
  6. Record the browser versions, platforms, observed icon, and any failures in your release checklist. Browser installation requirements and icon-selection behavior vary, so confirm them against current documentation for each target.

A browser may select different icons for different surfaces, and some platforms may use additional icon mechanisms outside the manifest. Include those platform-specific assets in your release review where applicable.

Common Mistakes

  • Resolving relative icon paths against the HTML page instead of the manifest.
  • Checking only HTTP status and missing an HTML fallback, incorrect image bytes, or a decoding error.
  • Assuming a .png extension guarantees PNG content, or that a sizes declaration changes the actual image dimensions.
  • Treating a successful automated check as proof that an icon is eligible for, selected by, or displayed on every target platform.
  • Testing only a fresh page load and overlooking cached responses or an already-installed app.

Best Practices

Keep an inventory of the final manifest and icon URLs for each deployment. Use intentional, stable paths; review redirects and response headers; and validate the actual image files as part of release checks. Pair automated preflight checks with documented installation and visual tests on your supported browser-platform combinations.

Conclusion

Resolve each icon from the deployed manifest, inspect the final image rather than just its status code, and verify the installed result on your target platforms. Those checks catch different classes of failure, so none replaces the others.

What would your domain sell for?

A free TidyURLs account unlocks the Domain Estimator. It prices a name from 191,011 real domain sales.