You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Custom user agent for web widgets (web:useragent)
#3617
web:useragenttype (added in #2454 for #2442) lets a web widget pretend to be an iPhone or an Android phone. There is no way to set any other user agent, and some sites refuse Electron's default one, which includes Wave/0.14.5 and Electron/41.1.0.
Proposal: a block meta key web:useragent that takes a full user agent string and wins over web:useragenttype. Choosing a preset from the context menu would clear it.
Scenarios
1. Sites that block unknown browsers. WhatsApp Web inside a Wave web widget only shows "WhatsApp works with Google Chrome 100+". With a desktop Chrome UA it can live in Wave next to the terminal, in its own partition:
"whatsapp": {
"icon": "brands@whatsapp",
"label": "WhatsApp",
"blockdef": {
"meta": {
"view": "web",
"url": "https://web.whatsapp.com/",
"web:partition": "persist:whatsapp",
"web:useragent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36"
}
}
}
2. Web development. Run the dev server in a terminal block and look at the page next to it the way a given client sees it: a Firefox UA, an old Safari, or a crawler for server-side rendering and SEO checks.
3. Devices beyond the two presets. A tablet layout (iPad), a specific Android device, or a desktop layout on purpose in a narrow block. Today only iPhone and Android phone are available.
"web:useragent": "Mozilla/5.0 (iPad; CPU OS 17_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.0 Mobile/15E148 Safari/604.1"
4. Not announcing the app. Some people would rather not send Wave/… and Electron/… versions to every site they open in a widget. A plain browser UA, set once per widget, avoids that.
Implementation
I have this working in a local build: about 60 lines across webview.tsx, the meta types and customwidgets.mdx, plus unit tests.
The preset mapping that is duplicated today in the render path and the reload effect becomes one function.
The webview reloads when the resolved UA changes.
While a custom string is set, the context menu shows a checked "Custom" item.
I tested it on macOS arm64 by checking the User-Agent header and navigator.userAgent for the default, both presets, a custom string, a custom string together with a preset, and a live switch on an open block.
Would a PR for this be welcome? Or would you prefer another shape, for example a "custom" value for web:useragenttype with a second key holding the string?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
web:useragenttype(added in #2454 for #2442) lets a web widget pretend to be an iPhone or an Android phone. There is no way to set any other user agent, and some sites refuse Electron's default one, which includesWave/0.14.5andElectron/41.1.0.Proposal: a block meta key
web:useragentthat takes a full user agent string and wins overweb:useragenttype. Choosing a preset from the context menu would clear it.Scenarios
1. Sites that block unknown browsers. WhatsApp Web inside a Wave web widget only shows "WhatsApp works with Google Chrome 100+". With a desktop Chrome UA it can live in Wave next to the terminal, in its own partition:
2. Web development. Run the dev server in a terminal block and look at the page next to it the way a given client sees it: a Firefox UA, an old Safari, or a crawler for server-side rendering and SEO checks.
3. Devices beyond the two presets. A tablet layout (iPad), a specific Android device, or a desktop layout on purpose in a narrow block. Today only iPhone and Android phone are available.
4. Not announcing the app. Some people would rather not send
Wave/…andElectron/…versions to every site they open in a widget. A plain browser UA, set once per widget, avoids that.Implementation
I have this working in a local build: about 60 lines across
webview.tsx, the meta types andcustomwidgets.mdx, plus unit tests.I tested it on macOS arm64 by checking the
User-Agentheader andnavigator.userAgentfor the default, both presets, a custom string, a custom string together with a preset, and a live switch on an open block.Would a PR for this be welcome? Or would you prefer another shape, for example a
"custom"value forweb:useragenttypewith a second key holding the string?All reactions