Class PWAHeadTags
java.lang.Object
com.iizix.pwa.PWAHeadTags
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">and512x512to theanyicons, 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'srel=icon, and thefavicon.icolinks stop at 64 px);apple-mobile-web-app-title(the App's name) andapple-mobile-web-app-capable(legacy, still read below iOS 26);- two
theme-colormetas,(prefers-color-scheme: light)and(... dark): the App's opaquethemeColorin both (a referenced colour resolved per scheme), else--iz-bg2of 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 Summary
FieldsMethod Summary
Modifier and TypeMethodDescriptionstatic StringApplies the head of an application page for a language: the<html>tag'slanganddir, the X-UA-Compatible meta removed, the title and the description replaced by the App's, and the tags ofgenerateTags(ModuleApp,PWAProps,String,PWAIcons)inserted before</head>.static StringApplies the head of an application page asapply(String,ModuleApp,PWAProps,String,PWAIcons)does, the manifest link named for another language than the page's texts (seegenerateTags(ModuleApp,PWAProps,String,String,PWAIcons)).static StringgenerateTags(ModuleApp app, PWAProps pwa, String lang, PWAIcons icons) Generates the tags of an installable application for a language.static StringGenerates 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 linksmanifest.webmanifest(ruling PW-3).
Field Details
DEFAULT_THEME_COLOR_LIGHT
The lighttheme-colorwhen the App has no opaquethemeColor:--iz-bg2of the default family (IIZI), light.- See Also:
DEFAULT_THEME_COLOR_DARK
The darktheme-colorwhen the App has no opaquethemeColor:--iz-bg2of the default family (IIZI), dark.- See Also:
Method Details
generateTags
Generates the tags of an installable application for a language.- Parameters:
app- The App.pwa- The application's PWA properties,nullwhen it has no.iiziPWA; only its presence is used.lang- The language code of the page.icons- The generated icons, ornullwhen 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 linksmanifest.webmanifest(ruling PW-3).- Parameters:
app- The App.pwa- The application's PWA properties,nullwhen 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 formanifest.webmanifest.icons- The icons, ornullwhen 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
Applies the head of an application page for a language: the<html>tag'slanganddir, the X-UA-Compatible meta removed, the title and the description replaced by the App's, and the tags ofgenerateTags(ModuleApp,PWAProps,String,PWAIcons)inserted before</head>.- Parameters:
html- The page.app- The App.pwa- The application's PWA properties, ornull.lang- The language code of the page, null or empty for none: the<html>tag is then left as it is.icons- The icons, ornull.- 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 asapply(String,ModuleApp,PWAProps,String,PWAIcons)does, the manifest link named for another language than the page's texts (seegenerateTags(ModuleApp,PWAProps,String,String,PWAIcons)).- Parameters:
html- The page.app- The App.pwa- The application's PWA properties, ornull.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 formanifest.webmanifest.icons- The icons, ornull.- Returns:
- The page with its head applied.
- Throws:
IllegalArgumentException- If there are tags to insert and the page has no</head>.