stackblitz / webcontainer-docs

WebContainer API Documentation
MIT License
71 stars 23 forks source link

feat: allow overriding the user-agent check #14

Closed fvsch closed 1 year ago

fvsch commented 1 year ago

This PR adds the ability to bypass the feature and user-agent check in the isWebContainerSupported function, by adding any non-empty value for the webcontainer_any_ua key in localStorage.

This is intended to allow testing of browsers that we have excluded because they currently do not run WebContainers at all (Safari 16.3 and earlier releases), upcoming versions of those browser (Safari 16.4 Beta and later releases), and other web browsers which happen to run afoul of our simple UA checks for other reasons.

Steps for testing:

  1. Use a browser such as Safari.
  2. Go to https://webcontainers.io (or, when testing, a Netlify preview deploy for this PR).
  3. Open the browser console and run localStorage.webcontainer_any_ua = 1.
  4. Reload the page.

Expected result:

Screenshot of the current "Incompatible web browser" warning, for context:

Screenshot

stackblitz[bot] commented 1 year ago

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

netlify[bot] commented 1 year ago

Deploy Preview for webcontainer-docs ready!

Name Link
Latest commit 1b1a533c950c1b9dfa3887087c49ce2b351e3256
Latest deploy log https://app.netlify.com/sites/webcontainer-docs/deploys/63f35f62a542fe00086a20a4
Deploy Preview https://deploy-preview-14--webcontainer-docs.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.