Overriding User-Agent in WebView

I’m trying to request the desktop version of a site by setting the User-Agent header. When I inspect the headers that are sent the UA header is still the default Safari user agent.

const ua = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_4) AppleWebKit/604.3.5 (KHTML, like Gecko) Version/10.1 Safari/602.1 EdgiOS/45.8.14';

const wv = new WebView();
const url = 'https://manytools.org/http-html-text/http-request-headers/';
const request = new Request(url);
request.headers = { 'User-Agent': ua };
await wv.loadRequest(request);
await wv.present(true);

I have this same question, is no one able to answer this? Is it even possible to set the User Agent in a Web View?

I have the same question.

Is there any way to make WebView open the desktop version of a webpage in WebView on iPhone? In Safari or in the ‘Show Web View’ shortcut action, you can request a desktop version by tapping the ‘aA’ button. Scriptable’s WebView doesn’t have that; it’s always mobile web on iPhone and desktop web on iPad. I tried the following but to no avail:

r = new Request('https://www.threads.net/login')
r.headers = {'User-Agent':'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.6 Safari/605.1.15'}
v = new WebView()
v.loadRequest(r)
await v.present()

Yes, the website in question is the Threads web because you cannot log in in the mobile version; it tells you to get the app instead. I wonder if there’s any workaround. I emailed Simon about a week ago but no reply yet.