PM 31.0.0 Useragent problems Topic is solved

Talk about code development, features, specific bugs, enhancements, patches, and similar things.
Forum rules
Please keep everything here strictly on-topic.
This board is meant for Pale Moon source code development related subjects only like code snippets, patches, specific bugs, git, the repositories, etc.

This is not for tech support! Please do not post tech support questions in the "Development" board!
Please make sure not to use this board for support questions. Please post issues with specific websites, extensions, etc. in the relevant boards for those topics.

Please keep things on-topic as this forum will be used for reference for Pale Moon development. Expect topics that aren't relevant as such to be moved or deleted.
User avatar
pm4eva
Moonbather
Moonbather
Posts: 74
Joined: 2018-06-12, 10:26
Location: CET

PM 31.0.0 Useragent problems

Unread post by pm4eva » 2022-05-18, 03:38

My settings are all default just what i changed is

general.useragent.override; Mozilla/5.0 (X11; U; Linux x86_64; rv:100.0) Gecko/20100101 Firefox/100.0
general.useragent.site_specific_overrides; false

within PM 28 it works but within PM 31 not and it does not override the useragent string

the only thing what works with PM 31 is to change
general.useragent.compatMode.version
to 91.0 for example

but i want change the whole string and the reason is that for some sites i want do that
with an addon with a switch button to fake the OS and the browser

general.useragent.override does not work anymore
please change that back cos it can be important for testing sites with a different string
thx and greets

User avatar
RealityRipple
Astronaut
Astronaut
Posts: 644
Joined: 2018-05-17, 02:34
Location: Los Berros Canyon, California
Contact:

Re: PM 31.0.0 Useragent problems

Unread post by RealityRipple » 2022-05-18, 03:45

https://www.palemoon.org/releasenotes-archived.shtml#v28.17.0
The global user-agent override was moved to the networking component where it is actually implemented. The new preference name is network.http.useragent.global_override. Please note that using a blanket override is normally (very) counterproductive and does not, in fact, help much with privacy. It would also override the compatibility modes (Native/Gecko/Firefox) in Pale Moon. As such, the browser will now warn you if the user-agent is globally overridden (in preferences) and allow you to easily reset that override and re-enable the various compatibility modes.

vannilla
Moon Magic practitioner
Moon Magic practitioner
Posts: 2181
Joined: 2018-05-05, 13:29

Re: PM 31.0.0 Useragent problems

Unread post by vannilla » 2022-05-18, 12:29

If you need it only for specific websites, use sasuga or PermissionPlus, both available from the addons site.

User avatar
pm4eva
Moonbather
Moonbather
Posts: 74
Joined: 2018-06-12, 10:26
Location: CET

Re: PM 31.0.0 Useragent problems

Unread post by pm4eva » 2022-05-19, 17:37

network.http.useragent.global_override
seems to work but the addons what using the old overrider dont work anymore

If there is no important reason for changing the variable i think it would better to change it back.
All older Addons are using general.useragent.override
thx and greets

User avatar
Moonchild
Pale Moon guru
Pale Moon guru
Posts: 35404
Joined: 2011-08-28, 17:27
Location: Motala, SE
Contact:

Re: PM 31.0.0 Useragent problems

Unread post by Moonchild » 2022-05-19, 19:58

No, it will not be changed back.
See implementation notes from 28.17 (almost 1.5 years ago!) as to the reasoning behind this change, also explained multiple times on this forum.
"Sometimes, the best way to get what you want is to be a good person." -- Louis Rossmann
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite

User avatar
moonbat
Knows the dark side
Knows the dark side
Posts: 4942
Joined: 2015-12-09, 15:45
Contact:

Re: PM 31.0.0 Useragent problems

Unread post by moonbat » 2022-05-20, 02:12

pm4eva wrote:
2022-05-18, 03:38
to fake the OS and the browser
Bad idea, it breaks sites that wrongly rely only on the user-agent for feature detection and does nothing in terms of privacy because there are dozens of other ways to uniquely identify you. This is why site specific overrides exist - to fix sites that break due to UA sniffing, as already explained above.
"One hosts to look them up, one DNS to find them and in the darkness BIND them."

Image
Linux Mint 21 Xfce x64 on HP i5-5200 laptop, 12 GB RAM.
AutoPageColor|PermissionsPlus|PMPlayer|Pure URL|RecordRewind|TextFX

User avatar
pm4eva
Moonbather
Moonbather
Posts: 74
Joined: 2018-06-12, 10:26
Location: CET

Re: PM 31.0.0 Useragent problems

Unread post by pm4eva » 2022-05-20, 09:06

Moonchild wrote:
2022-05-19, 19:58
No, it will not be changed back.
OK
thx and greets

User avatar
pm4eva
Moonbather
Moonbather
Posts: 74
Joined: 2018-06-12, 10:26
Location: CET

Re: PM 31.0.0 Useragent problems

Unread post by pm4eva » 2022-05-20, 09:15

moonbat wrote:
2022-05-20, 02:12
Bad idea......
I know why specific site override exist and its a really good thing.
If i remember right even the Addons from PM Addon site did not work as i tried them, or arent comfortable.
And i am not sure how a user can add a website to specific-override, or manage that within an addon or menue.
thx and greets

User avatar
Moonchild
Pale Moon guru
Pale Moon guru
Posts: 35404
Joined: 2011-08-28, 17:27
Location: Motala, SE
Contact:

Re: PM 31.0.0 Useragent problems

Unread post by Moonchild » 2022-05-20, 10:23

pm4eva wrote:
2022-05-20, 09:15
And i am not sure how a user can add a website to specific-override, or manage that within an addon or menue.
Use any of the available extensions like Sasuga,
or go into about:config and make a general.useragent.override.yourdomain.com preference and put in whatever US string you want or need for yourdomain.com

Or use forum search to get more posts to explain the same (in more detail)
"Sometimes, the best way to get what you want is to be a good person." -- Louis Rossmann
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite

User avatar
pm4eva
Moonbather
Moonbather
Posts: 74
Joined: 2018-06-12, 10:26
Location: CET

Re: PM 31.0.0 Useragent problems

Unread post by pm4eva » 2022-10-06, 15:19

i looked in the code of the extention and i think we could change it that it works again with the old and new palemoon version within 1 extention.

but i am not sure if we could fork the extention without the OK from the author.
he also did not write me back as i asked him with email.

the thing is, this extionsion works with 1 click to switch different UA or set it to default.
if we could fork it and include even the option that site-specific-UAs would be work if the extension is set do default (no override) then it would be the best thing ever.
thx and greets

User avatar
Moonchild
Pale Moon guru
Pale Moon guru
Posts: 35404
Joined: 2011-08-28, 17:27
Location: Motala, SE
Contact:

Re: PM 31.0.0 Useragent problems

Unread post by Moonchild » 2022-10-06, 16:05

It's ultimately up to you but I do not recommend global overrides. You'd be playing whack-a-mole, instead of only using a custom UA when necessary. "one click to break most sites"...
"Sometimes, the best way to get what you want is to be a good person." -- Louis Rossmann
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite

User avatar
pm4eva
Moonbather
Moonbather
Posts: 74
Joined: 2018-06-12, 10:26
Location: CET

Re: PM 31.0.0 Useragent problems

Unread post by pm4eva » 2022-10-06, 17:19

I do understand you totaly. I know UAS Addon is not the best solution for all users.
So what do you think about a comfortable Addon what uses an Icon to shows the UA on mousover
and let u change or add the site-specific-UA if nessecary with 1 click at the Icon as simple as it could be?
I think no one want change or add things in about:config.
The Icon also could change the color if a different UA is in use.
That would be much better and u would get a visual info about that.
thx and greets

User avatar
jobbautista9
Keeps coming back
Keeps coming back
Posts: 780
Joined: 2020-11-03, 06:47
Location: Philippines
Contact:

Re: PM 31.0.0 Useragent problems

Unread post by jobbautista9 » 2022-10-07, 02:52

My extension seems to be close to what you want. I've just added the tooltip text functionality which is trivial. It's annoying though that to set an element's "tooltiptext" in JavaScript, you have to use "tooltipText". Like why Mozilla, why do you have to make the JavaScript property camelCase and the XUL attribute all lowercase? Anyway, I'm not sure about changing the icon's color if a different UA is currently in use, maybe I will have to read some more docs on where to find the variable/function that contains the default useragent as shown by about:support...
Image

merry mimas

XUL add-ons developer. You can find a list of add-ons I manage at http://rw.rs/~job/software.html.

Mima avatar by 絵虎. Pixiv post: https://www.pixiv.net/en/artworks/15431817

Image

vannilla
Moon Magic practitioner
Moon Magic practitioner
Posts: 2181
Joined: 2018-05-05, 13:29

Re: PM 31.0.0 Useragent problems

Unread post by vannilla » 2022-10-07, 07:39

jobbautista9 wrote:
2022-10-07, 02:52
Anyway, I'm not sure about changing the icon's color if a different UA is currently in use, maybe I will have to read some more docs on where to find the variable/function that contains the default useragent as shown by about:support...
You could make it check if a SSUAO preference exists for that particular domain it is considered as "different user agent" even if the value is the same.
After all, even if by chance the value ends up being the same as the default, the fact that there is an override means that something had to be changed, not to mention the next update that value will necessarily be different.

User avatar
jobbautista9
Keeps coming back
Keeps coming back
Posts: 780
Joined: 2020-11-03, 06:47
Location: Philippines
Contact:

Re: PM 31.0.0 Useragent problems

Unread post by jobbautista9 » 2022-10-07, 09:28

Ah, that could work I guess. I ended up copying the useragent code used by about:support though (xref source). My problem right now is how I could properly change the add-on's icon in the status bar (I'm using the image XUL element as some sort of button) with JavaScript. I know I can change the list-style-image CSS property, but I'm not sure how to account for when the user changes the toolbar's iconsize... Here's the code I have right now for getting the useragent:

Code: Select all

function getUA() {
 let uaStatusIcon = document.getElementById("ua-status-control");
 let uaStatusTextbox = document.getElementById("ua-status-input");
 let brwsrtoolbar = document.getElementById("addon-bar"); // Status bar
 let currentUA = gBrowser.contentWindow.navigator.userAgent;
 let defaultUA = Cc["@mozilla.org/network/protocol;1?name=http"]
                 .getService(Ci.nsIHttpProtocolHandler)
                 .userAgent;
 if (gBrowser.contentWindow.location.hostname) {
  uaStatusTextbox.value = uaStatusIcon.tooltipText = currentUA;
  if (currentUA != defaultUA) {
   if (brwsrtoolbar.getAttribute("iconsize") == "large") {
    uaStatusIcon.style.listStyleImage = "url(chrome://ua-status/skin/icon24_m.gif)";
   } else {
    uaStatusIcon.style.listStyleImage = "url(chrome://ua-status/skin/icon16_m.gif)";
   }
  } else {
   if (brwsrtoolbar.getAttribute("iconsize") == "large") {
    uaStatusIcon.style.listStyleImage = "url(chrome://ua-status/skin/icon24.gif)";
   } else {
    uaStatusIcon.style.listStyleImage = "url(chrome://ua-status/skin/icon16.gif)";
   }
  }
 }
}
While it can account for iconsize changes in the status bar, it will only update the icon once the user changes location (could be loading up a different page or switch to another tab). It's jarring, since if you changed the iconsize to "small", the icon will remain 24px until you change location. At least the color stuff works properly so maybe I could release this right now as 1.3.0 and figure out how to properly account for this in a 1.3.1. It's not like the average user is going to constantly change their toolbar's iconsize... :P

EDIT: What's also nice about the solution I used for getting the default useragent is that it can also account for default SSUAOs. Maybe I will use it together with your solution to get three "states" or "colors"!
Image

merry mimas

XUL add-ons developer. You can find a list of add-ons I manage at http://rw.rs/~job/software.html.

Mima avatar by 絵虎. Pixiv post: https://www.pixiv.net/en/artworks/15431817

Image

User avatar
pm4eva
Moonbather
Moonbather
Posts: 74
Joined: 2018-06-12, 10:26
Location: CET

Re: PM 31.0.0 Useragent problems

Unread post by pm4eva » 2022-10-07, 12:37

i did not install your addon yet but what i saw is that it needs alot space in the statusbar.
i think it would be cool that this is an option and could be switch visible or not.

the best solution i think is just a movable icon in adressbar or menubar and if u mousover just the actual UA string will pop up.
and the color of the icon should change color if a site-specific-UA is in use
and if anyone like that in statusbar too just as an option
(an alternative could be another addon called statusbar-organizer what allows u to make it invisible)

another thing is that i do not like that sites can see what OS is in use
its my business only and should not care anyone else

anyways, great work
thx and greets

User avatar
jobbautista9
Keeps coming back
Keeps coming back
Posts: 780
Joined: 2020-11-03, 06:47
Location: Philippines
Contact:

Re: PM 31.0.0 Useragent problems

Unread post by jobbautista9 » 2022-10-07, 15:08

pm4eva wrote:
2022-10-07, 12:37
i did not install your addon yet but what i saw is that it needs alot space in the statusbar.
i think it would be cool that this is an option and could be switch visible or not.
This feature you ask is literally in the add-on's description since day one:
Pale Moon Add-ons wrote: Just click on the extension's icon on the statusbar to toggle the form and its buttons.
Anyway, I don't plan on making the extension movable to other toolbars. This is by design as the add-on's name suggests (the "status" is there for a reason). So it's staying in the status bar, sorry.
Image

merry mimas

XUL add-ons developer. You can find a list of add-ons I manage at http://rw.rs/~job/software.html.

Mima avatar by 絵虎. Pixiv post: https://www.pixiv.net/en/artworks/15431817

Image

User avatar
moonbat
Knows the dark side
Knows the dark side
Posts: 4942
Joined: 2015-12-09, 15:45
Contact:

Re: PM 31.0.0 Useragent problems

Unread post by moonbat » 2022-10-07, 23:03

pm4eva wrote:
2022-10-07, 12:37
it needs alot space in the statusbar.
Can't you drag it from the statusbar to wherever else you want it while the toolbar customization dialog is open? I have a separate toolbar on top for addons since I have more than 100 installed.
"One hosts to look them up, one DNS to find them and in the darkness BIND them."

Image
Linux Mint 21 Xfce x64 on HP i5-5200 laptop, 12 GB RAM.
AutoPageColor|PermissionsPlus|PMPlayer|Pure URL|RecordRewind|TextFX

vannilla
Moon Magic practitioner
Moon Magic practitioner
Posts: 2181
Joined: 2018-05-05, 13:29

Re: PM 31.0.0 Useragent problems

Unread post by vannilla » 2022-10-08, 09:06

moonbat wrote:
2022-10-07, 23:03
Can't you drag it from the statusbar to wherever else you want it while the toolbar customization dialog is open? I have a separate toolbar on top for addons since I have more than 100 installed.
jobbautista9 is probably using the actual statusbar. The "customizable statusbar" is actually a toolbar placed at the bottom of the window; the statusbar proper is different and things placed there can't be moved.

User avatar
jobbautista9
Keeps coming back
Keeps coming back
Posts: 780
Joined: 2020-11-03, 06:47
Location: Philippines
Contact:

Re: PM 31.0.0 Useragent problems

Unread post by jobbautista9 » 2022-10-08, 12:01

Yes, I'm indeed using the actual statusbar; here's the latest code of my overlay XUL:

Code: Select all

<overlay id="ua-status-overlay"
         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
  <script type="application/javascript" src="overlay.js" />

  <statusbar id="status-bar">
    <statusbarpanel id="ua-status-control-panel">
     <image id="ua-status-toggle-nossuao"
            context="ua-status-context-menu"
            onclick="leftClickToggle(event);"
            onmouseover="updateTooltip();"
            hidden="false" />
     <image id="ua-status-toggle-vendorssuao"
            context="ua-status-context-menu"
            onclick="leftClickToggle(event);"
            onmouseover="updateTooltip();"
            hidden="true" />
     <image id="ua-status-toggle-userssuao"
            context="ua-status-context-menu"
            onclick="leftClickToggle(event);"
            onmouseover="updateTooltip();"
            hidden="true" />
     <image id="ua-status-toggle-na"
            context="ua-status-context-menu"
            onclick="leftClickToggle(event);"
            onmouseover="updateTooltip();"
            hidden="true" />
     <menupopup id="ua-status-context-menu">
      <menuitem name="UAStatus-ShowInAboutConfig"
                id="ua-status-contextmenuitem-showinaboutconfig"
                label="&uastatus.showinaboutconfig;"
                oncommand="showInAboutConfig();" />
      <menuitem name="UAStatus-SetUA"
                id="ua-status-contextmenuitem-setua"
                label="&uastatus.setua;"
                oncommand="contextSetUA();" />
      <menuitem name="UAStatus-ResetUA"
                id="ua-status-contextmenuitem-resetua"
                label="&uastatus.resetua;"
                oncommand="resetUA();" />
     </menupopup>
    </statusbarpanel>
    <statusbarpanel id="ua-status-main"> <!-- hidden="true" -->
      <label class="statusbarpanel-text" id="ua-status-label">Useragent</label>
      <textbox id="ua-status-main-input"
               onkeydown="if ((event.which || event.keyCode) == 13) mainSetUA();" />
      <button id="ua-status-button-setua"
              label="&uastatus.setua;"
              oncommand="mainSetUA();" />
      <button id="ua-status-button-resetua"
              label="&uastatus.resetua;"
              oncommand="resetUA();" />
    </statusbarpanel>
  </statusbar>
</overlay>
I figured out how to properly account for iconsize changes in the status bar. As you can see from the code above, I just needed to copypasta the image element. I probably didn't have to do that since I realize you can only change the status bar's iconsize if you have FranklinDM's Toolbox Plus extension installed (i.e. you can't do this in a vanilla, fresh profile). But meh, might as well play nice with other extensions. Besides, it made my JavaScript code cleaner, so maybe I needed it after all. :D
Image

merry mimas

XUL add-ons developer. You can find a list of add-ons I manage at http://rw.rs/~job/software.html.

Mima avatar by 絵虎. Pixiv post: https://www.pixiv.net/en/artworks/15431817

Image

Locked