Bugs :  K-Meleon Web Browser Forum
You can talk about issues with k-meleon here.  
User Agent
Posted by: Somersault
Date: December 25, 2005 02:55PM

Could be just me, but I'm having difficulties with the User Agent setting in KM 0.9. I run a server at a remote location, and have full log access. The other day I tried out the User Agent settings to take a look at what KM actually reported. (Opera, for instance, indeed masquerades as Internet Explorer if you ask it, but, paradoxically, reminds you that it's Opera anyway.)

To my surprise, changing the User Agent setting apparently had no effect at all on what KM sent to my server, even after restarting. There was only one effect; I run a Java applet from the server, and when I told KM to identify as Opera 7.54, the applet wouldn't work.

Some of you may know that I've been experimenting with moving the KM profile (see the General forum) and I suppose this may have had side effects, but I'm not sure if what I'm experiencing is a bug or if I'm misinterpreting the results or doing something wrong.

Suggestions would be welcome.

Somersault

Options: ReplyQuote
Re: User Agent
Posted by: bst82551
Date: December 25, 2005 07:33PM

Maybe K-Meleon's reading it from the cache. Try clearing out your cache by going to (Tools > Privacy > Clear Cache).
By the way, would the applet load in K-Meleon when you had it set to use the default K-Meleon User Agent string?
I run a server on my computer and when I set the User Agent in my K-MeleonCCF 0.04 RC2, it works as it should. I can only guess that it could be loading from your cache.

Brian

Options: ReplyQuote
Re: User Agent
Posted by: Drahken
Date: December 26, 2005 12:41PM

If you use browserspy to check your useragent, you'll find that changing the agent doesn't actually change anything, it merely adds the new agent in addition to the old. It appears that there are actually 2 places where the UA is stored, and changing it only changes one of them.

Options: ReplyQuote
Re: User Agent
Posted by: CaptnBlack
Date: December 26, 2005 01:57PM

I'm using K-M, but browserspy shows my UA as:
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8) Gecko/20051124 Firefox/1.5
and browser name as: Mozilla Firefox 1.5

I use this setting to change it:
user_pref("general.useragent.override", "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8) Gecko/20051124 Firefox/1.5");

Options: ReplyQuote
Re: User Agent
Posted by: Drahken
Date: December 26, 2005 06:22PM

That's the thing. That isn't available by default. The only ones available by default are general.useragent.vendor, general.useragent.vendorSub, and the various kmeleon.privacy.useragentXXX ones.
The KM.privacy ones obviously don't change/hide everything since you still see this on the browserspy page: Vendor Kmeleon-Mozilla.
The useragnet.venodr ones leve you with a string like this if you try to change them: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8b4) Gecko/20050910 Kmeleon-Mozilla/9.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.6) Gecko/20050226 Firefox/1.5

I just tried the useragent.override string, and it works to get rid of that doubled UA, but it still doesn't change the vendor. It looks like you have to set both that one and the vendor one in order to effectively disguise your UA.

Options: ReplyQuote
Re: User Agent
Posted by: CaptnBlack
Date: December 26, 2005 11:14PM

You can change the vendor too, if needed.
Here's the pref that sets the vendor name:

general.useragent.vendor

Options: ReplyQuote
Re: User Agent
Posted by: CaptnBlack
Date: December 26, 2005 11:15PM

And I forgot this one:

general.useragent.vendorSub

That sets the version number.

Options: ReplyQuote
Re: User Agent
Posted by: Drahken
Date: December 27, 2005 01:08PM

I know. *points up to previous post* "The only ones available by default are general.useragent.vendor, general.useragent.vendorSub, and the various kmeleon.privacy.useragentXXX ones. "

What I don't knbow is why the browser is so stubborn about identifying itself, and making it such a pain to truly change the UA. :-\

Options: ReplyQuote
Re: User Agent
Posted by: CaptnBlack
Date: December 27, 2005 02:23PM

Oh... sorry.
I should read your posts more closely.

I don't think it would be very difficult to create macros to change all the user agent prefs at once.

Would it be better to have a set of default UAs to choose from, or be able to set each pref individually ?

Options: ReplyQuote
Re: User Agent
Posted by: Drahken
Date: December 27, 2005 05:32PM

It would be best to have some good defaults. An IE one, a FF v1+ one, and possibly an opera one. The FF1+ one would be the most useful since it's A) similar to what KM truly is, yet cool smiley many sites that don't support all browsers list a recent version of FF as well as IE in the browsers that they support.

Options: ReplyQuote
Re: User Agent
Posted by: CaptnBlack
Date: December 28, 2005 09:02PM

I modified the existing useragent macros
so that it sets all three useragent prefs at once.
I also modified the custom UA macros so that you can set all three prefs individually.
I removed the "Reset to default on exit" pref.
If none of the UA optins are checked you know you've set a custom UA.
You can alter the UAs in the user_prefs to fit your needs, or leave them as they are.
If you do alter them, you might have to alter the menus.cfg to match them if needed.


In prefs.js add/replace:


user_pref("kmeleon.privacy.useragent0.name", "K-Meleon");
user_pref("kmeleon.privacy.useragent0.string", "");
user_pref("kmeleon.privacy.useragent1.name", "MSIE 6.0");
user_pref("kmeleon.privacy.useragent1.string", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)");
user_pref("kmeleon.privacy.useragent2.name", "Netscape 4.8");
user_pref("kmeleon.privacy.useragent2.string", "Mozilla/4.8 [en] (Windows NT 5.1; U)");
user_pref("kmeleon.privacy.useragent3.name", "Opera 7.54");
user_pref("kmeleon.privacy.useragent3.string", "Opera/7.54 (Windows NT 5.1; U) [en]");
user_pref("kmeleon.privacy.useragent4.name", "Firefox 1.5");
user_pref("kmeleon.privacy.useragent4.string", "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8) Gecko/20051124 Firefox/1.5");


In macros.cfg add/replace:


#------------User Agent Override----------------#

$ua="general.useragent.override"; $uas="";
$pu="kmeleon.privacy.useragent"; $ps=".string";
$uar="kmeleon.privacyUA.noReset";
$uaven="general.useragent.vendor"; $uav="";
$uasven="general.useragent.vendorSub"; $uasv="";


UA0{
$uas=getpref(STRING,$pu."0".$ps); &SetUA;
setpref(STRING,$uaven,"K-Meleon");
setpref(STRING,$uasven,"0.9");
}
UA1{
$uas=getpref(STRING,$pu."1".$ps); &SetUA;
setpref(STRING,$uaven,"MSIE");
setpref(STRING,$uasven,"6.0");
}
UA2{
$uas=getpref(STRING,$pu."2".$ps); &SetUA;
setpref(STRING,$uaven,"Netscape 4.8");
setpref(STRING,$uasven,"4.8");
}
UA3{
$uas=getpref(STRING,$pu."3".$ps); &SetUA;
setpref(STRING,$uaven,"Opera");
setpref(STRING,$uasven,"7.54");
}
UA4{
$uas=getpref(STRING,$pu."4".$ps); &SetUA;
setpref(STRING,$uaven,"Firefox");
setpref(STRING,$uasven,"1.5");
}
UACust{
$uas=getpref(STRING,$ua);
$uas=prompt("Enter the User Agent string to identify K-Meleon as:","Custom User Agent",$uas);
$uas==""?"":&SetUA; &UACustV;
}
UACustV{
$uav=getpref(STRING,$uaven);
$uav=prompt("Enter Vendor string:","Custom Vendor",$uav);
$uav==""?"":&SetVen; &UACustSV;
}
UACustSV{
$uasv=getpref(STRING,$uasven);
$uasv=prompt("Enter VendorSub string:","Custom VendorSub",$uasv);
$uasv==""?"":&SetSVen;
}
SetUA{
setpref(STRING,$ua,$uas); &Sync;
}
SetVen{
setpref(STRING,$uaven, $uav);
}
SetSVen{
setpref(STRING,$uasven, $uasv);
}



In # ----BUTTON & MENU SYNC---- add/replace:


setcheck("macros(UA0)",getpref(STRING,$pu."0".$ps)==getpref(STRING,$ua)? true:false);
setcheck("macros(UA1)",getpref(STRING,$pu."1".$ps)==getpref(STRING,$ua)? true:false);
setcheck("macros(UA2)",getpref(STRING,$pu."2".$ps)==getpref(STRING,$ua)? true:false);
setcheck("macros(UA3)",getpref(STRING,$pu."3".$ps)==getpref(STRING,$ua)? true:false);
setcheck("macros(UA4)",getpref(STRING,$pu."4".$ps)==getpref(STRING,$ua)? true:false);



In menus.cfg:

User Agent{
macros(UA0, K-Meleon (Default))
macros(UA1, Internet Explorer 6 (XP))
macros(UA2, Netscape 4.8 (XP))
macros(UA3, Opera 7.54 (XP))
macros(UA4, Firefox 1.5 (XP))
macros(UACust, Custom...)
}

Options: ReplyQuote
Re: User Agent
Posted by: CaptnBlack
Date: December 28, 2005 09:09PM

I just noticed I made a mistake.

This:

UA2{
$uas=getpref(STRING,$pu."2".$ps); &SetUA;
setpref(STRING,$uaven,"Netscape 4.8");
setpref(STRING,$uasven,"4.8");
}

Should be this:

UA2{
$uas=getpref(STRING,$pu."2".$ps); &SetUA;
setpref(STRING,$uaven,"Netscape");
setpref(STRING,$uasven,"4.8");
}

Options: ReplyQuote
Re: User Agent
Posted by: George
Date: December 29, 2005 05:08PM

To solve UA problem the user agent spoofing function could change UA and change general.useragent.vendor and general.useragent.vendorSub as well and all other values at once. Then when you exit the browser could change those values to default if Reset to Default on Exit is checked which is the Kmeleon Browser User Agent.

Options: ReplyQuote
Re: User Agent
Posted by: CaptnBlack
Date: December 30, 2005 12:37AM


I Added back the "Reset to Default on Exit".

In prefs.js add/replace:


user_pref("kmeleon.privacy.useragent0.name", "K-Meleon");
user_pref("kmeleon.privacy.useragent0.string", "");
user_pref("kmeleon.privacy.useragent1.name", "MSIE 6.0");
user_pref("kmeleon.privacy.useragent1.string", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)");
user_pref("kmeleon.privacy.useragent2.name", "Netscape 4.8");
user_pref("kmeleon.privacy.useragent2.string", "Mozilla/4.8 [en] (Windows NT 5.1; U)");
user_pref("kmeleon.privacy.useragent3.name", "Opera 7.54");
user_pref("kmeleon.privacy.useragent3.string", "Opera/7.54 (Windows NT 5.1; U) [en]");
user_pref("kmeleon.privacy.useragent4.name", "Firefox 1.5");
user_pref("kmeleon.privacy.useragent4.string", "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8) Gecko/20051124 Firefox/1.5");


In macros.cfg add/replace:

OnQuit{
getpref(BOOL,$uar)!=true? &UA:"";
}

#------------User Agent Overide----------------#

$ua="general.useragent.override"; $uas="";
$pu="kmeleon.privacy.useragent"; $ps=".string";
$uar="kmeleon.privacyUA.noReset";
$uaven="general.useragent.vendor"; $uav="";
$uasven="general.useragent.vendorSub"; $uasv="";

UA{
delpref($ua); macros(UA0); &Sync;
}

UA0{
$uas=getpref(STRING,$pu."0".$ps); &SetUA;
setpref(STRING,$uaven,"K-Meleon");
setpref(STRING,$uasven,"0.9");
}
UA1{
$uas=getpref(STRING,$pu."1".$ps); &SetUA;
setpref(STRING,$uaven,"MSIE");
setpref(STRING,$uasven,"6.0");
}
UA2{
$uas=getpref(STRING,$pu."2".$ps); &SetUA;
setpref(STRING,$uaven,"Netscape");
setpref(STRING,$uasven,"4.8");
}
UA3{
$uas=getpref(STRING,$pu."3".$ps); &SetUA;
setpref(STRING,$uaven,"Opera");
setpref(STRING,$uasven,"7.54");
}
UA4{
$uas=getpref(STRING,$pu."4".$ps); &SetUA;
setpref(STRING,$uaven,"Firefox");
setpref(STRING,$uasven,"1.5");
}
UACust{
$uas=getpref(STRING,$ua);
$uas=prompt("Enter the User Agent string to identify K-Meleon as:","Custom User Agent",$uas);
$uas==""?"":&SetUA; &UACustV;
}
UACustV{
$uav=getpref(STRING,$uaven);
$uav=prompt("Enter Vendor string:","Custom Vendor",$uav);
$uav==""?"":&SetVen; &UACustSV;
}
UACustSV{
$uasv=getpref(STRING,$uasven);
$uasv=prompt("Enter VendorSub string:","Custom VendorSub",$uasv);
$uasv==""?"":&SetSVen;
}
SetUA{
setpref(STRING,$ua,$uas); &Sync;
}
SetVen{
setpref(STRING,$uaven, $uav);
}
SetSVen{
setpref(STRING,$uasven, $uasv);
}
ResetUA{
togglepref(BOOL,$uar); &Sync;
}


In # ----BUTTON & MENU SYNC---- add/replace:

setcheck("macros(UA0)",getpref(STRING,$pu."0".$ps)==getpref(STRING,$ua)? true:false);
setcheck("macros(UA1)",getpref(STRING,$pu."1".$ps)==getpref(STRING,$ua)? true:false);
setcheck("macros(UA2)",getpref(STRING,$pu."2".$ps)==getpref(STRING,$ua)? true:false);
setcheck("macros(UA3)",getpref(STRING,$pu."3".$ps)==getpref(STRING,$ua)? true:false);
setcheck("macros(UA4)",getpref(STRING,$pu."4".$ps)==getpref(STRING,$ua)? true:false);
setcheck("macros(ResetUA)",getpref(BOOL,$uar)?false:true);


In menus.cfg:

User Agent{
macros(UA0, K-Meleon (Default))
macros(UA1, Internet Explorer 6 (XP))
macros(UA2, Netscape 4.8 (XP))
macros(UA3, Opera 7.54 (XP))
macros(UA4, Firefox 1.5 (XP))
macros(UACust, Custom...)
-
macros(ResetUA, Reset to Default on Exit)
}

Options: ReplyQuote
Re: User Agent
Posted by: old_navy
Date: December 30, 2005 02:16AM

May I make changes in user.js instead prefs.js for User Agent?

Options: ReplyQuote
Re: User Agent
Posted by: guenter
Date: December 30, 2005 06:06AM

@old_navy: yes.

Options: ReplyQuote
Re: User Agent
Posted by: Somersault
Date: January 01, 2006 03:56PM

Gosh, haven't checked here in a few days and seems there's been quite a bit of activity. Thanks to CaptnBlack for the suggestions, which I'll try after I get some paying work out of the way.

Oh, and Happy New Year to you all.

Somersault

Options: ReplyQuote
Re: User Agent
Posted by: bst82551
Date: January 01, 2006 08:42PM

Good luck and Happy New Year!
Now go earn some $$$ ;-).

Brian

Options: ReplyQuote


K-Meleon forum is powered by Phorum.