Skip to content

Add mobile web app support (Add to Home Screen)#91

Open
kraftbj wants to merge 2 commits intotrunkfrom
mobile-web-app
Open

Add mobile web app support (Add to Home Screen)#91
kraftbj wants to merge 2 commits intotrunkfrom
mobile-web-app

Conversation

@kraftbj
Copy link
Collaborator

@kraftbj kraftbj commented Mar 6, 2026

Summary

Enables Press This to work as a standalone mobile web app that can be added to the home screen on Android and iOS. Implements the core features from #2 (originally WordPress core Trac #33195).

  • Add Web App Manifest served via REST endpoint (/press-this/v1/manifest) with Share Target API support (Android)
  • Add mobile web app meta tags (mobile-web-app-capable, apple-mobile-web-app-capable, theme-color, etc.)
  • Add app icons (pencil on WordPress blue) at 180px, 192px, and 512px
  • Handle standalone display mode: skip window.close() in redirects, add "View Site" and "New Post" menu items
  • Sync fallback script dependencies with generated asset file

Share Target

The manifest share_target reuses Press This's existing GET params (?u=...&t=...), so sharing a URL from another Android app opens Press This with the URL pre-filled — no editor changes needed.

Future enhancements

These are out of scope for this PR but documented for future work:

  • Service Worker — cache app shell for instant loading (caveat: iOS evicts SW cache after ~7 days of inactivity)
  • Apple splash screensapple-touch-startup-image tags per device resolution
  • Push notifications — notify of pending drafts or publishing status (requires iOS 16.4+)
  • Share Target file sharing — accept shared images/files via POST + multipart/form-data
Feature Android iOS
Add to Home Screen Yes Yes
Standalone mode Yes Yes
Share Target Yes No (WebKit limitation)

Test plan

  • Load Press This, view source — confirm all meta tags present in <head>
  • Fetch /wp-json/press-this/v1/manifest — confirm valid JSON with correct dynamic URLs
  • Android: Open in Chrome, install as app, launch from home screen — confirm standalone mode with pencil icon
  • iOS: Open in Safari, Share > Add to Home Screen, launch — confirm standalone mode with proper icon
  • Android: Install PWA, share a URL from another app — confirm Press This opens with the shared URL
  • In standalone mode: confirm "More actions" menu shows "View Site" and "New Post" options
  • In standalone mode: publish a post — confirm redirect goes to the post URL instead of trying window.close()
  • Launch from home screen with no URL params — confirm editor loads as empty post

Enable Press This to work as a standalone mobile web app via Add to
Home Screen on Android and iOS. Adds Web App Manifest with Share Target
API support, app icons, mobile web app meta tags, and standalone mode
UI handling.

Closes #2

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@kraftbj kraftbj requested a review from Copilot March 6, 2026 23:30
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds Progressive Web App (Add to Home Screen) support for Press This, including a web app manifest endpoint and UI behavior tweaks for standalone display mode.

Changes:

  • Serve a Web App Manifest via a new public REST endpoint, including Share Target support.
  • Add standalone-mode behavior adjustments (redirect behavior + menu items).
  • Add mobile web app meta tags and icon/manifest links in the Press This HTML head.

Reviewed changes

Copilot reviewed 5 out of 8 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/components/PressThisEditor.js Detects standalone mode to adjust redirect behavior.
src/components/Header.js Adds standalone-only menu items and standalone detection.
press-this-plugin.php Registers a new REST route and returns the manifest JSON.
includes/class-press-this-assets.php Syncs script dependencies by adding wp-keyboard-shortcuts.
class-wp-press-this-plugin.php Injects mobile web app meta tags and manifest/icon links.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Set Content-Type to application/manifest+json per W3C spec. Localize
the app name in both the manifest endpoint and the apple-mobile-web-app-title
meta tag for translation support.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants