Skip to content
This repository has been archived by the owner on Jul 22, 2024. It is now read-only.

Website Compatibility

Randall E. Barker edited this page Jul 6, 2020 · 5 revisions

VR, mobile, and desktop user-agent presentation

Many websites present different versions of their content depending on the type of device the site believes it is interacting with. Sites typically infer the user's device type based on the string in the User-Agent HTTP request header, which is a short piece of text passed by the browser to the web server with every HTTP request. (See Firefox's default User-Agent values.)

By default, Firefox Reality presents a User-Agent string which identifies it as running on a device with VR capabilities. However, some sites may incorrectly present their content in this mode. Firefox Reality allows you to quickly swap between User-Agent strings that correspond to desktop, mobile, or VR versions of the browser, as follows:

  1. Go to Settings.
  2. Choose Display Options.
  3. Choose an option from the User-Agent Mode setting.

The page will reload with the chosen user agent.

Screenshot of setting user agent mode

User-Agent Overrides

When users report a site that requires a specific User-Agent string, including sites that require presentation as a non-Mozilla browser, these are incorporated into a list of User-Agent overrides in the Firefox Reality browser.

The overrides can be found in the source of the codebase in JSON format at app/src/main/assets/userAgentOverride.json. The first key -> value pair in each entry is a SHA-512 hash of the domain to which the UA override applies -> User-Agent override string to use for that domain.

Tip: You can generate a hash for a sitename in a bash shell thus:

echo -n 'example.com' | shasum -a 512

Or you can use this online hash generator.

If Firefox Reality encounters a URL that matches https://cdn.delight-vr.com/, it will look up in the override list for an origin, traversing any subdomains, that matches the origin. In other words, a URL request for cdn.delight-vr.com (hash: 1bf3eb69b1c904a7327d0cb068aee987bb9ab8d79f5a63cc6dc6b961571a5952d745f5f64f3c40c65560aa8a864e5581aca7f7d6f699daaa77951a4097489180) will use the User-Agent override value for delight-vr.com (hash: 14628752378ac2ca5e38083aca63f468e55cdf13a56c075dd6ac8e444dd1d29bdab58f737730c8309a84acf2d21d582cf8e32136d255e2171b09fb861fc19a10) if cdn.delight-vr.com does not appear in the override list.

Web Extensions

Included in Firefox Reality

Firefox Reality ships with default Web Extension content scripts to make improvements to such sites as YouTube to provide an optimal user experience for consumption in a VR browser.

YouTube

Web Extension

app/src/main/assets/web_extensions/webcompat_youtube/

April 11, 2019 (v1.1.3e, v1.2-rc2)
  • Added support for automatically upgrading default playback to HD 1440p (PR #1052) (issue #1051)
    • Forces default YouTube video playback to HD 1440p or next best available (issue #1051)
March 29, 2019 (v1.1.3)

Debugging

Remote Debugging from Firefox Reality

Instructions for testing with Firefox Reality:

  1. Launch Firefox Reality.

  2. From the tray menu at the bottom, open Settings > Developer Options.

  3. Select Enable Remote Debugging.

  4. From Android Studio, make changes to the files in app/src/main/assets/web_extensions/.

  5. Press Run > Run 'app', select your device in the list of Connected Devices at the top, and press the OK button.

  6. To test the extension, navigate to a webpage (e.g., a YouTube page):

    adb shell am start -a android.intent.action.VIEW -n org.mozilla.vrbrowser/org.mozilla.vrbrowser.VRBrowserActivity -d "https://www.youtube.com/channel/UC0XhbNGFvsdU7Vv6S3JbR2w"

  7. To test and debug the Web Extension and the page’s JavaScript, use Firefox Reality’s and Firefox desktop’s Remote Debugging (via the WebIDE or about:debugging).

Development and testing from Firefox desktop

  1. Launch desktop Firefox, and navigate to this URL: about:debugging#/runtime/this-firefox

  2. Click the checkbox to enable Enable extension debugging.

    screenshot of "Firefox Debugging – Runtime"

  3. Press the Load Temporary Add-on… button and select the Web Extenstion by selecting its directory in app/src/main/assets/web_extensions.

    Loading an unpackaged Web Extension on Firefox desktop

Clone this wiki locally