Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kiwi's UA #428

Open
IcedWatermelonJuice opened this issue Nov 2, 2021 · 11 comments
Open

Kiwi's UA #428

IcedWatermelonJuice opened this issue Nov 2, 2021 · 11 comments
Labels
enhancement New feature or request

Comments

@IcedWatermelonJuice
Copy link

IcedWatermelonJuice commented Nov 2, 2021

I want to distinguish between chrome and kiwi, but Kiwi's UA is so similar to chrome's that it is difficult to distinguish.

@IcedWatermelonJuice IcedWatermelonJuice added the enhancement New feature or request label Nov 2, 2021
@KaKi87
Copy link
Collaborator

KaKi87 commented Nov 2, 2021

Why would anyone want that, unless you'd want to maliciously and discriminatorily inflict degraded user experience to Kiwi Browser users ?

@danny0838
Copy link

danny0838 commented Nov 3, 2021

It is obvious that the essential of the user agent is to provide a meaningful expression of the user agent that is distinguishable from a different one. It is also very helpful for the developer to make the code more compatible to different browsers, which may have very different behaviors in some aspects that cannot be detected by any available API.

As a matter of fact, most Chomium-based browsers, such as Opera, Vilvadi, Brave, and new Edge, have a distinguishable UA from Chromium and Google Chrome. I don't think Kiwi is any different from them.

Although it is possible that some bad sites use the UA in a wrong malicious or discriminatory way, it should be relatively rare as breaking user experience is generally doing nothing good for the web site owner. There are also user agent switcher extensions available for customizing the UA for such special cases. IMHO, Faking the UA natively due to such reason is like throwing away the apple because of the core.

@KaKi87
Copy link
Collaborator

KaKi87 commented Nov 3, 2021

It is also very helpful for the developer to make the code more compatible to different browsers

I would agree if we were talking about distinguishing browsers that use different rendering engines, like Chrome (Blink, formerly Webkit) vs Firefox (Quantum, formerly Gecko) vs Safari (Webkit).

But in this case, Kiwi uses Chrome, so everything that works on Chrome, must work on Kiwi, or be reported here. Therefore, there is no point in differenciating Kiwi from Chrome, unless you want to implement a dirty workaround.

Moreover, Kiwi Browser is the only open source Chromium-based Android browser that allows unlimited access to Chrome extensions, therefore hostile website developers would be more interested in discriminating it than others, especially to counteract content blockers.

@danny0838
Copy link

danny0838 commented Nov 3, 2021

There may be a difference so long as Kiwi is a different browser, even if it uses the same engine.

For example, can the bug I just reported in #427 be fixed? Are the developers willing to fix it? How long does it take to be fixed? If it can't be fixed in no time for any reason, there would be a need for the web site developer to use the user agent to deal with such issue for better browser compatibility. (Actually, the developers still need the UA to support the users that use the older browser versions with the bug unfixed even if it is fixed in the newer version...)

It might be possible that a feature detection can work for this, but not every bug can be dealt with feature detection. OTOH, if a feature detection is possible for such thing, a malicious site can also use it to do the same thing for a discriminatory purpose. After all, faking user agent won't actually work as long as there is any detectable feature difference among the different browsers.

@gnadelwartz
Copy link

gnadelwartz commented Nov 3, 2021

feature or bug detection based on User-Agent is IMHO the worst thing a web developer can do. stick to Webstandards and common set of features. browser specific (JavaScript) implementation and bugs should be detected dynamically but not on UA., e.g. use https://modernizr.com/docs/

this is also the reason why Google had planned to remove UA https://www.infoq.com/news/2020/03/chrome-phasing-user-agent/

@danny0838
Copy link

danny0838 commented Nov 3, 2021

@gnadelwartz I agree that UA detection is generally the worst thing. Unfortunately, it is the only thing the developer can do in many cases, and many of them is what I have actually done in my projects.

About the point that "Google plans to remove UA": The User Agent Client Hints project Google has planned is to make a more accurate version of UA and make developers detect the user agent more easily, instead of making it impossible. This clearly is a dis-support instead of a support for the argument "UA is useless/bad".

@gnadelwartz
Copy link

gnadelwartz commented Nov 3, 2021

let me phrase it this way: classic UA-string is exactly this: a string of unstructured content, you can try to extract information from but you will fail for whatever reason. relying on this random string is at least ugly.

UA hints are http response headers containing information in a well defined format, even it may a bad idea to use this for bug or feature detection, it is not based on parsing a random string.

as always opinions may vary

@danny0838
Copy link

@gnadelwartz If I understand it correctly, this topic is about whether to provide a true user agent conventionally or to mimic/fake Chrome user agent, regardless of using the traditional UA or the new UA hints proposed by Google. What is your opinion about this?

@gnadelwartz
Copy link

gnadelwartz commented Nov 3, 2021

I'm uncertain, as this may break random sites/parsing script's while the advantage is only for a small subset who want to optimize for kiwi.

e.g. kiwi has a special UA implemented for Facebook because Facebook parse UA instead of screen resolution.
the downside iis that now Facebook Always redirect to mobile even I use kiwi on tablet.

in my opinion kiwi is 100% chromium with desktop features enabled on mobile, therefore it's valid to use chromium UA. non chromium compatible HTML/CSS/JS behvior as in #425 is a bug and must be fixed.

@MTHS1901
Copy link

MTHS1901 commented Oct 26, 2022

I did some tests comparing differences between "window" elements in Chrome PC/Android browser and Kiwi Browser, and for some reason in Kiwi Browser navigator.userAgentData.brands[2] is set to "undefined" so you could use the code below to set whether it is Kiwi browser or not.

!!chrome && navigator.userAgentData.brands[2] == undefined (if is true, you are on kiwi)

!!chrome && !!chrome.runtime no longer works, after 106 update.

@foxjaw
Copy link

foxjaw commented Nov 12, 2023

Can anyone share how you guys change UA in Kiwi if possible ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

6 participants