Ed Johnson-Williams' microblog

MacOS lets you install websites to your computer as standalone web apps as of MacOS Sonoma.

After some experimentation, here's how you can detect with javascript if your site is in a web app. standalone isn't a standard property of the navigator object so Typescript will shout at you if you don't put add the interface.

interface Navigator {
    standalone?: boolean;

// Your existing code
if (navigator.standalone) {
    // macOS Sonoma web app
} else if (navigator.standalone === false) {
    // Safari on macOS or iOS
} else {
    // Another browser


Last updated:

Back to all posts