Skip to content

fix: use like android user-agent

Administrator requested to merge change-ua into master

I've been having problems with websites treating my user-agent as Android, which makes sense because Firefox is literally reporting itself as Android. Usually, this does improve the user-experience. However, sometimes websites that have mobile apps stop the user from using the web app in favor of the Android app, which isn't ideal because this isn't an Android device.

Slack is the primary example for this. I've been able to work around it by using the Header Editor browser extension to modify my user-agent.

Reference: #39 (comment 1463350879)

I'm now contacting websites, requesting that they explicitly handle Linux mobile. Unfortunately, the user-agent provided by this Firefox package is indistinguishable from other Android user-agents, so before they can take action, we need to be separable.

Can we please adopt what KDE did with Plasma Angelfish?

QString UserAgent::userAgent() const
{
    return QStringLiteral(
               "Mozilla/5.0 (%1) AppleWebKit/%2 (KHTML, like Gecko) QtWebEngine/%3 "
               "Chrome/%4 %5 Safari/%6")
        .arg(m_isMobile ? QStringLiteral("Linux; Plasma Mobile, like Android 9.0") : QStringLiteral("X11; Linux x86_64"),
             m_appleWebKitVersion,
             m_webEngineVersion,
             m_chromeVersion,
             m_isMobile ? u"Mobile" : u"Desktop",
             m_safariVersion);
}

https://invent.kde.org/network/angelfish/-/blob/master/lib/useragent.cpp#L24

They report themselves as Linux, but like Android.

So, ours would look like Linux; like Android 10. This way we retain the word Android as a fallback, but websites that explicitly handle Linux will have the means to stop pushing Android apps on us. 👍

Related

Edited by Administrator

Merge request reports

Loading