Skip to content

Instantly share code, notes, and snippets.

@dzeitman
Created March 4, 2025 18:02
Show Gist options
  • Select an option

  • Save dzeitman/8c3f88344e79bc9604636753919e80a0 to your computer and use it in GitHub Desktop.

Select an option

Save dzeitman/8c3f88344e79bc9604636753919e80a0 to your computer and use it in GitHub Desktop.
WebGPU alert for Safari.
function isIOS() {
return /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream;
}
function isSafari() {
return /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
}
function isWebGPUSupported() {
return !!navigator.gpu;
}
function showEnableWebGPUPopup() {
const message = `
🚀 WebGPU is not enabled in Safari on iOS.
To enable WebGPU:
1. Open **Settings** on your iPhone/iPad.
2. Go to **Safari** > **Advanced** > **Experimental Features**.
3. Find **WebGPU** and toggle it ON.
4. Restart Safari and try again.
After enabling WebGPU, refresh this page.
`;
alert(message);
}
window.onload = function () {
if (isIOS() && isSafari() && !isWebGPUSupported()) {
showEnableWebGPUPopup();
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment