Class PWAHeadTags

java.lang.Object
com.iizix.pwa.PWAHeadTags

public final class PWAHeadTags extends Object
The tags the application page gets in its <head> (PWA-DESIGN.md 3.4 and 3.5, order CC-PWA-V5B-MANIFEST), for the page the application directory generates per language (order V5-E, which calls this class).

For an installable application (.iiziPWA present, PWAManifest.isInstallable(PWAProps)), inserted before </head>:

  • <link rel="manifest" href="manifest-<lang>.webmanifest">, relative, so it resolves inside /app/<appID>/;
  • <link rel="icon" type="image/png" sizes="192x192"> and 512x512 to the any icons, and <link rel="apple-touch-icon" sizes="180x180"> to the Apple icon, each when the icons hold that file (rulings PI-4, PM-3: a desktop-class Safari takes the page's rel=icon, and the favicon.ico links stop at 64 px);
  • apple-mobile-web-app-title (the App's name) and apple-mobile-web-app-capable (legacy, still read below iOS 26);
  • two theme-color metas, (prefers-color-scheme: light) and (... dark): the App's opaque themeColor in both (a referenced colour resolved per scheme), else --iz-bg2 of the default family, light and dark - right before any script runs; following a changed scheme is A5's.

For every application, installable or not: <title> and <meta name="description"> are replaced by the App's name and description for the language, when the App has them; the <html> tag gets lang of the page's language and dir="rtl" for a right-to-left one (ruling PM-1); and <meta http-equiv="X-UA-Compatible"> is removed (ruling PM-5: it addressed Internet Explorer, which the server gate refuses).

No member of .iiziPWA is read (AU-9). Pure: text in, text out.

Author:
Christopher Mindus
  • Field Details

    • DEFAULT_THEME_COLOR_LIGHT

      public static final String DEFAULT_THEME_COLOR_LIGHT
      The light theme-color when the App has no opaque themeColor: --iz-bg2 of the default family (IIZI), light.
      See Also:
    • DEFAULT_THEME_COLOR_DARK

      public static final String DEFAULT_THEME_COLOR_DARK
      The dark theme-color when the App has no opaque themeColor: --iz-bg2 of the default family (IIZI), dark.
      See Also:
  • Method Details

    • generateTags

      public static String generateTags(ModuleApp app, PWAProps pwa, String lang, PWAIcons icons)
      Generates the tags of an installable application for a language.
      Parameters:
      app - The App.
      pwa - The application's PWA properties, null when it has no .iiziPWA; only its presence is used.
      lang - The language code of the page.
      icons - The generated icons, or null when the App has none.
      Returns:
      The tags, one per line, each line ending with a newline; the empty string when the application is not installable.
    • generateTags

      public static String generateTags(ModuleApp app, PWAProps pwa, String lang, String manifestLang, PWAIcons icons)
      Generates the tags of an installable application for a language, the manifest link named for another: the one page of an application without languages carries the App's default language (ruling PM-1) but links manifest.webmanifest (ruling PW-3).
      Parameters:
      app - The App.
      pwa - The application's PWA properties, null when it has no .iiziPWA; only its presence is used.
      lang - The language code of the page's texts.
      manifestLang - The language code the manifest file is named for, null or empty for manifest.webmanifest.
      icons - The icons, or null when the application has none.
      Returns:
      The tags, one per line, each line ending with a newline; the empty string when the application is not installable.
    • apply

      public static String apply(String html, ModuleApp app, PWAProps pwa, String lang, PWAIcons icons)
      Applies the head of an application page for a language: the <html> tag's lang and dir, the X-UA-Compatible meta removed, the title and the description replaced by the App's, and the tags of generateTags(ModuleApp,PWAProps,String,PWAIcons) inserted before </head>.
      Parameters:
      html - The page.
      app - The App.
      pwa - The application's PWA properties, or null.
      lang - The language code of the page, null or empty for none: the <html> tag is then left as it is.
      icons - The icons, or null.
      Returns:
      The page with its head applied.
      Throws:
      IllegalArgumentException - If there are tags to insert and the page has no </head>.
    • apply

      public static String apply(String html, ModuleApp app, PWAProps pwa, String lang, String manifestLang, PWAIcons icons)
      Applies the head of an application page as apply(String,ModuleApp,PWAProps,String,PWAIcons) does, the manifest link named for another language than the page's texts (see generateTags(ModuleApp,PWAProps,String,String,PWAIcons)).
      Parameters:
      html - The page.
      app - The App.
      pwa - The application's PWA properties, or null.
      lang - The language code of the page, null or empty for none.
      manifestLang - The language code the manifest file is named for, null or empty for manifest.webmanifest.
      icons - The icons, or null.
      Returns:
      The page with its head applied.
      Throws:
      IllegalArgumentException - If there are tags to insert and the page has no </head>.