# Massage System PWA Launcher Experiment

This folder is a static launcher experiment for Android Chrome Add to Home Screen / Install app.

It does not change the Apps Script business app. It does not create PrintJobs, alter report PDF generation, or change any Google Sheet logic.

Current experiment mode: redirect mode.

Iframe mode was tested and blocked by the Apps Script / Google frame policy (`script.google.com refused to connect` / `X-Frame-Options: sameorigin`). Redirect mode does not iframe Apps Script. It shows a short loading screen, then top-level navigates to the production Apps Script `/exec` URL.

## Files

- `index.html` - standalone launcher shell that redirects to Apps Script.
- `manifest.webmanifest` - PWA manifest using `display: standalone`.
- `sw.js` - caches only the launcher shell assets.
- `icons/massage-icon.svg` - temporary experiment icon.

## Setup For Test Hosting

1. Host this folder on a normal HTTPS static host, such as Cloudflare Pages, Firebase Hosting, or GitHub Pages.
   - The paths are relative, so subdirectory hosting is supported, for example:

     ```text
     https://linxuan5858.github.io/massage-system/pwa-launcher/
     ```

2. In `index.html`, replace:

   ```text
   REPLACE_WITH_PRODUCTION_EXEC_URL
   ```

   with the production Apps Script `/exec` URL.
3. Open the hosted launcher in Honor Android Chrome.
4. Use Chrome menu > Add to Home screen / Install app.
5. Launch from the home screen and test report Open PDF.

## Redirect mode

This launcher does not use an iframe. It uses:

```javascript
window.location.replace(APPS_SCRIPT_EXEC_URL)
```

The goal is to test whether Chrome/Safari home-screen standalone mode is preserved after top-level navigation to Apps Script.

No Apps Script `ALLOWALL` iframe setting is needed for redirect mode.

If redirect mode still opens with browser UI after install, use this result to decide whether to move to a different hosting/PWA approach.

## Icon note

The included SVG icon is enough for a source experiment. If Android Chrome refuses install or shows a poor icon, add real PNG icons such as:

- `icons/icon-192.png`
- `icons/icon-512.png`
- `icons/apple-touch-icon.png`

and update `manifest.webmanifest` to reference them.

iPad/Safari home-screen metadata is included in `index.html`. The current `apple-touch-icon` uses the experiment SVG icon; replace it with a PNG if Safari does not display the icon correctly.

## Expected test result

- The app launches in Chrome standalone mode, not Hermit.
- The launcher top-level redirects to the Apps Script `/exec` URL.
- Open PDF still uses Chrome PDF handling.
- Download PDF remains available.
- No thermal/Xprinter PrintJobs are created.
