iOS Safari has no beforeinstallprompt API, so the portal's Install button (?install=1) silently did nothing there. IosInstallHint now shows Share -> Add to Home Screen steps on Safari, or a prompt to switch to Safari first if opened in another iOS browser/in-app webview (those can't install PWAs on iOS at all). Also added apple-mobile-web-app-title + apple-touch-icon so the home screen icon isn't a page screenshot, and added the beforeinstallprompt handler that was missing entirely (Android Install button did nothing either). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
19 lines
610 B
TypeScript
19 lines
610 B
TypeScript
import React from 'react'
|
|
import ReactDOM from 'react-dom/client'
|
|
import App from './App'
|
|
import './index.css'
|
|
|
|
// When opened from the portal's install button (?install=1), trigger the
|
|
// PWA install prompt as soon as the browser offers it (Chrome/Edge only).
|
|
if (new URLSearchParams(window.location.search).has('install')) {
|
|
window.addEventListener('beforeinstallprompt', e => {
|
|
e.preventDefault()
|
|
;(e as Event & { prompt: () => Promise<void> }).prompt()
|
|
}, { once: true })
|
|
}
|
|
|
|
ReactDOM.createRoot(document.getElementById('root')!).render(
|
|
<React.StrictMode>
|
|
<App />
|
|
</React.StrictMode>
|
|
)
|