Extensions :  K-Meleon Web Browser Forum
All about K-Meleon extensions. 
Some User Agent Changer for KM74?
Posted by: c-sanchez
Date: March 10, 2014 04:58AM

I am looking for some macro/extesion for km74, I would appreciate if any attached to a message.

I wonder if there is any updated version of AdBlock Plus to km74.

a problem (not sure if is K- Meleon or Google) is that now when the images of Google search engine is used with the default user agent, works normal, except that when you open a picture does not show a part page with the image and the typical other options " Open Full image", etc, but directly opens the page containing the image.
That's a bit unpleasant, now there are two options, or use a user agent like chrome. Or search the image, open it, open the page, open it directly from this and so get in its original resolution.

Excuse my English and thanks for the attention.

Options: ReplyQuote
Re: Some User Agent Changer for KM74?
Posted by: guenter
Date: March 13, 2014 06:58PM

Quote
c-sanchez
I am looking for some macro/extesion for km74, I would appreciate if any attached to a message.

I wonder if there is any updated version of AdBlock Plus to km74.

...

Excuse my English and thanks for the attention.

Sorry for late answer.


No worry about English. Most here are not speaking English except what we learned in school.

I have no knowledge about the Adblock extension. Try to use the Firefox version!
Or wait till Wladimir Palant updates the K-Meleon specific one.




You can probably use the switcher from 1.5.4's called useragent.kmm to get the same service as e.g. Firefox. I hope that is good enough.



It relies on code that used to be in I10n.js section Privacy.


Maybe put it into a separate file and call it UserAgents.js. It would be placed in

./k-Meleon/browser/preferences/UserAgents.js


/********************************************************************************************************/
// Privacy 
# UserAgent.js for Mozilla/5.0 (Windows NT 5.1; rv:24.3) Gecko/20140105 K-Meleon/74.0


pref("kmeleon.privacy.useragent1.name", "Firefox 24 ESR");
pref("kmeleon.privacy.useragent1.string", "Mozilla/5.0 (Windows NT 5.1; rv:24.3) Gecko/20100101 Firefox/24.3");
pref("kmeleon.privacy.useragent2.name", "SeaMonkey");
pref("kmeleon.privacy.useragent2.string", "Mozilla/5.0 (Windows NT 5.1; rv:27.0) Gecko/20100101 Firefox/27.0 SeaMonkey/2.24");





Else You place this string into any of the js in the 4 preferences *.js or create one new js for the setting.


pref("general.useragent.override", "Mozilla/5.0 (Windows NT 5.1; rv:24.3) Gecko/20140105 Firefox/24.3 K-Meleon/74.0");

The later is the way advocated by Mozilla.org.

So for example a current SeaMonkey would identify itself to a webpage as:

Mozilla/5.0 (Windows NT 5.1; rv:27.0) Gecko/20100101 Firefox/27.0 SeaMonkey/2.24




# The macro code of useragent.kmm from 1.5.4.


# 
# K-Meleon Macros (http://kmeleon.sourceforge.net/wiki/index.php?id=MacroLanguage)

# ---------- User Agent --------------------------------------------------------------------------------------------
# 
#
# Dependencies	: main.kmm ($macroPrefBranch)
# Resources	: -
# Preferences	: kmeleon.privacy.useragent[1,2,...].name
#		  kmeleon.privacy.useragent[1,2,...].string
#
# ------------------------------------------------------------------------------------------------------------------

UserAgent{
macroinfo=_("Set the specified User Agent string");
menuchecked=$ARG==""?(getpref(STRING,$_UserAgent_Active)=="")sad smileygetpref(STRING,$_UserAgent_Active)==getpref(STRING,$_UserAgent_Custom.$ARG.".string"));
$ARG==""?delpref($_UserAgent_Active):$_string=getpref(STRING,$_UserAgent_Custom.$ARG.".string");
$ARG==""?&_UserAgent_SyncMenu:&_UserAgent;
}
UserAgent_Custom{
macroinfo=_("Set a custom User Agent string");
$_string=prompt(_("Enter the User Agent string to identify K-Meleon as:"),_("Custom User Agent"),getpref(STRING,$_UserAgent_Active));
$_string==""?0:&_UserAgent;
}

UserAgent_AlertString{
macroinfo=_("View the current User Agent string");
injectJS("alert('"._("Current User Agent String:")."\\n\\n'+navigator.userAgent)");
}
UserAgent_ToggleReset{
macroinfo=_("Toggle resetting the default User Agent string when exiting");
menuchecked=getpref(BOOL,$_UserAgent_Reset);
togglepref(BOOL,$_UserAgent_Reset);
}

# ----- PRIVATE

$_UserAgent_Active="general.useragent.override";
$_UserAgent_Custom="kmeleon.privacy.useragent";
$_UserAgent_Reset=$macroPrefBranch."useragent.reset_on_exit";

_UserAgent{
$_string==""?delpref($_UserAgent_Active):setpref(STRING,$_UserAgent_Active,$_string); &_UserAgent_SyncMenu;
}
_UserAgent_SyncMenu{
$_data=getpref(STRING,$_UserAgent_Active);
setcheck("macros(UserAgent_Custom)",($_data!=""));
$_j=1; while($_j>0) &_UserAgent_SyncMenuLoop;
}
_UserAgent_SyncMenuLoop{
$__data=getpref(STRING,$_UserAgent_Custom.$_j.".string");
$__data==$_data?setcheck("macros(UserAgent_Custom)",false):0;
$_j=$__data==""?0:$_j+1;
}
$OnStartup=$OnStartup."_UserAgent_SyncMenu;";

_UserAgent_BuildMenu{
# tools menu
$_u="&User Agent";
setmenu(PrivacySecurity,popup,$_u);
setmenu($_u,macro,"Default","UserAgent()");
$_i=1; while($_i>0) &_UserAgent_BuildMenuLoop;
setmenu($_u,macro,"&Custom...",UserAgent_Custom);
setmenu($_u,macro,"&Reset To Default On Exit",UserAgent_ToggleReset);
setmenu($_u,separator,"&Reset To Default On Exit");
}
_UserAgent_BuildMenuLoop{
$__data=getpref(STRING,$_UserAgent_Custom.$_i.".name");
$__data==""?0:setmenu($_u,macro,$__data,"UserAgent(".$_i.")");
$_i=$__data==""?0:$_i+1;
}
$OnInit=$OnInit."_UserAgent_BuildMenu;";

_UserAgent_Reset{
getpref(BOOL,$_UserAgent_Reset)?delpref($_UserAgent_Active):0;
}
$OnQuit=$OnQuit."_UserAgent_Reset;";

# ------------------------------------------------------------------------------------------------------------------
$macroModules=$macroModules."UserAgent;";


Options: ReplyQuote
Re: Some User Agent Changer for KM74?
Posted by: JamesD
Date: March 13, 2014 09:43PM

Thanks Guenter,

Those were very good instructions for user agent.

I created privacy.js in root\browser\defaults\preferences and used the useragent.kmm file from prior versions and everything seems to work.

I have attached a copy f useragent.kmm here because the one you posted contains a smiley. I don't think the smiley will work in KM.

Attachments: useragent.kmm (3 KB)  
Options: ReplyQuote
Re: Some User Agent Changer for KM74?
Posted by: c-sanchez
Date: March 14, 2014 12:05AM

Quote
Sorry for late answer.
No problem, better late than never grinning smiley

For curiously, because that have been removed useragent changer from KM74?

I do not get to run properly useragent in KM74 (beta 3)

If there is no open web page, only one page "about: blank", change user agent and I will google, this is not configured with the new user agent. is (apparently) necesary change the user agent with web page open.

If can attach a zip ready to install best tongue sticking out smiley

Options: ReplyQuote
Re: Some User Agent Changer for KM74?
Posted by: guenter
Date: March 14, 2014 07:32AM

Quote
JamesD
Thanks Guenter,

Those were very good instructions for user agent.

I created privacy.js in root\browser\defaults\preferences and used the useragent.kmm file from prior versions and everything seems to work.

I have attached a copy f useragent.kmm here because the one you posted contains a smiley. I don't think the smiley will work in KM.

Sorry. I forgot to deactivate smilies.sad smiley

If that happend to someone You'd press Quote and take the code from there.

p.s. I use the second choice also and always identify as

Mozilla/5.0 (Windows NT 5.1; rv:24.3) Gecko/20140105 Firefox/24.3 K-Meleon/74.0



Edited 1 time(s). Last edit at 03/14/2014 07:33AM by guenter.

Options: ReplyQuote
Re: Some User Agent Changer for KM74?
Posted by: guenter
Date: March 14, 2014 07:42AM

Quote
c-sanchez
Quote
Sorry for late answer.
No problem, better late than never grinning smiley

For curiously, because that have been removed useragent changer from KM74?

I do not get to run properly useragent in KM74 (beta 3)

If there is no open web page, only one page "about: blank", change user agent and I will google, this is not configured with the new user agent. is (apparently) necesary change the user agent with web page open.

If can attach a zip ready to install best tongue sticking out smiley

1.) You remove not needed things temporarily to fix other bugs easier.

2.) For KM 74b3 it is the same procedure.

You place the JS with the strings into ./K-Meleon74b3/browser/defaults/preferences

And You place the useragent.kmm macro into ./K-Meleon74b3/macros.

It does work for me. I tested it.


p.s. With web pages You have to reload after a change of the UserAgentString and some pages require that You go away because like Yahoo they set a cookie or send to a special error page that does not re-read the brosers's version.



Edited 1 time(s). Last edit at 03/14/2014 08:05AM by guenter.

Options: ReplyQuote
Re: Some User Agent Changer for KM74?
Posted by: c-sanchez
Date: March 16, 2014 02:48AM

Quote

I have no knowledge about the Adblock extension. Try to use the Firefox version!
Or wait till Wladimir Palant updates the K-Meleon specific one.
K-Meleon supports Firefox extensions??? :s



Edited 1 time(s). Last edit at 03/16/2014 02:48AM by c-sanchez.

Options: ReplyQuote
Re: Some User Agent Changer for KM74?
Posted by: Dorian
Date: March 17, 2014 01:27PM

@guenter
To add firefox to the UA String, don't use override. Set the pref "general.useragent.compatMode.firefox" to true.

I was wondering if I should set it to true by default, because i'm afraid it may not be good for browser usage statistics.

Options: ReplyQuote
Re: Some User Agent Changer for KM74?
Posted by: siria
Date: March 17, 2014 05:57PM

In fact I often find getting LESS "old browser" complaints with native KM1.6 string than with FF3.5 string. Makes me think some people in power seem to like KM smiling smiley

Options: ReplyQuote
Re: Some User Agent Changer for KM74?
Posted by: guenter
Date: April 01, 2014 06:27PM

Quote
Dorian
@guenter
To add firefox to the UA String, don't use override. Set the pref "general.useragent.compatMode.firefox" to true.

I was wondering if I should set it to true by default, because i'm afraid it may not be good for browser usage statistics.

Thx for the info.


IMHO we should keep the old system with the macro.

And use

Mozilla/5.0 (Windows NT 5.1; rv:24.3) Gecko/20140105 Firefox/24.3 K-Meleon/74.0

instead of FF as first deafault substitute and Seamoney including FF string as second.

Options: ReplyQuote
Re: Some User Agent Changer for KM74?
Posted by: JamesD
Date: April 02, 2014 11:49AM

Quote
guenter
IMHO we should keep the old system with the macro.

I agree. There are enough items to fix without spending time on things that are not broken.

Options: ReplyQuote


K-Meleon forum is powered by Phorum.