Eclipse-Community / r3dfox

r3dfox is a modern Firefox based web browser for Windows Vista & 7. SourceForge link for downloading with older browsers. https://sourceforge.net/projects/r3dfox/
https://eclipse.cx/projects/r3dfox
Other
198 stars 7 forks source link

Browser is misidentified as Netscape 5 by some websites, causing compatibility issues #12

Closed Kiki79250CoC closed 8 months ago

Kiki79250CoC commented 8 months ago

I noticed that Google was displayed using their "legacy" code, so I checked and noticed that r3dfox is recognized as Netscape 5 because website UA parser does not recognize r3dfox's UA and uses the "Mozilla/5.0" part to "recognize" the browser.

image

So I searched how other browser behaves to avoid this issue and noticed thay Mypal includes "Firefox/78.0" in it's UA.

image

So the fix to this problem is somewhat simple: You must include "Firefox/122.0" in r3dfox's UA as well to resolve those compatibility issues. This would be something like this:

Before: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:122.0) Gecko/20100101 r3dfox/122.0.1 After: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:122.0) Gecko/20100101 Firefox/122.0 r3dfox/122.0.1

With this addition, the website parser would detect the "Firefox/122.0" part and behave like a regular Firefox 122 browser.

K4sum1 commented 8 months ago

Yeah I should do that, but I'm not really sure how.

jonm58 commented 8 months ago

use general.useragent.override fix lol (only for user)

Kiki79250CoC commented 8 months ago

OK, I read the code, and there's two options available:

  1. Enable general.useragent.compatMode.firefox natively

OR (if you want to make it permanently enabled whatever the state of general.useragent.compatMode.firefox)

  1. in /netwerk/protocol/http/nsHttpHandler at Lines 791-796, you have this:
791 |  bool isFirefox = mAppName.EqualsLiteral("Firefox");
792 |  if (isFirefox || mCompatFirefoxEnabled) {
793 |    // "Firefox/x.y" (compatibility) app token
794 |    mUserAgent += ' ';
795 |    mUserAgent += mCompatFirefox;
796 |  }

Remove lines 791, 792 and 796.

That bool is checking if the app is named "Firefox" or if general.useragent.compatMode.firefox is set on TRUE

jonm58 commented 8 months ago

https://support.mozilla.org/en-US/kb/how-reset-default-user-agent-firefox general.useragent.extra.r3dfox lol

K4sum1 commented 8 months ago

OK, I read the code, and there's two options available:

1. Enable `general.useragent.compatMode.firefox` natively

OR (if you want to make it permanently enabled whatever the state of general.useragent.compatMode.firefox)

2. in [/netwerk/protocol/http/nsHttpHandler](https://github.com/Eclipse-Community/r3dfox/blob/d791f7d7341091b78ba57480f1f81611f0dea8d5/netwerk/protocol/http/nsHttpHandler.cpp) at Lines 791-796, you have this:
791 |  bool isFirefox = mAppName.EqualsLiteral("Firefox");
792 |  if (isFirefox || mCompatFirefoxEnabled) {
793 |    // "Firefox/x.y" (compatibility) app token
794 |    mUserAgent += ' ';
795 |    mUserAgent += mCompatFirefox;
796 |  }

Remove lines 791, 792 and 796.

That bool is checking if the app is named "Firefox" or if general.useragent.compatMode.firefox is set on TRUE

I also had to remove 797-803 for it to work. What's the way to have the MyPal setup of both?

Kiki79250CoC commented 8 months ago

Mypal just enables general.useragent.compatMode.firefox by default.

Also what lines 797-803 does is just adding r3dfox/122.0.1 at the end of the UA, something which can describe what fork you have. not very needed in fact but you can left it as it, just if you do this, revert the removal of line 791 (or remove the if condition and left the code that was in it).

K4sum1 commented 8 months ago

Cool, that works, making a build and will publish a release soon (~1 hour for optimzied build)

K4sum1 commented 8 months ago

https://github.com/Eclipse-Community/r3dfox/releases/tag/122.0.1-beta-ua