Many thanks to JujuLand and adodupan. I had dropped a comma in my readreg statement.
I would prefer to use a pref but the answer also has to be read by Javascript. The proposed standard for 'do not track' is that the user can control whether to enable or disable the feature. The header for DNT is either a 1 or a 0.
Now all I have to do is get donottrack.js to read the registry item.
K-Meleon 1.6.0 beta 2.4 Win 7 (32 bit)
Re: Value type for single digit number in registry
JamesD, my suggestion is that you spend your time in something useful to you. There are few reasons for this suggestion. I suppose that you want play with code, but your plan is wrong and that will make your game hard.
First, javascript is a primary language of the browser, and in your game registry is absolutely unnecessary [look in chrome, all files are written in javascript, and some files use km prefs].
Also, suggestion about autoit tool, is useful as it is useful that you swim with a stone on your back [hello Alain :)].
Finally, best of all is that km does not need any donottrack.js, km already has these options. Also, my nnSurf just use these options.
Regards to all
Re: Value type for single digit number in registry
I think you are right. I cannot discover what object to use to with the read statement when in donottrack.js.
I am seriously thinking of removing donottrack.js from my system. All the free stuff on the web is paid for by advertisers. If nobody sees their adds then they will see no value to providing the sites.
K-Meleon 1.6.0 beta 2.4 Win 7 (32 bit)
Re: Value type for single digit number in registry
JamesD, my suggestion is related exclusively to writing code, with the intention to spare you of your mistakes in the beginning. With your plan, fun writing would probably become a nightmare. I don't intend to change your attitude about privacy on the web.
Re: Value type for single digit number in registry
JamesD, i hope this example will help you to learn how to use kmprefs in javascript.
Green line is disabled code, blue is new or changed code.
root\components file donottrack.js
/*
donottrack.js
Jonathan Mayer - jmayer@stanford.edu
An XPCOM component that adds a Do Not Track header to all web requests.
myFactory:
{
QueryInterface: function (aIID)
{
if (!aIID.equals(Components.interfaces.nsISupports) && !aIID.equals(Components.interfaces.nsIFactory))
throw Components.results.NS_ERROR_NO_INTERFACE;
return this;
},
createInstance: function (outer, iid)
{
return new DNTHTTPListener();
}
},
canUnload: function(compMgr)
{
return true;
}
};
function NSGetModule(compMgr, fileSpec)
{
return myModule;
}
Macrolanguage, just for menu item.
root\macros file doNotTrack.kmm
$OnInit=$OnInit."_doNotTrack_01;";
$macroModules=$macroModules."doNotTrack;";
_doNotTrack_01{
setmenu("&Privacy",inline,_doNotTrack,_Privacy_Settings);
setmenu(_doNotTrack,macro,"I do not want to be tracked",_doNotTrack_02);
}
_doNotTrack_02{
macroinfo=_("Toggle Do Not Track");
menuchecked=getpref(INT,"navigator.doNotTrack")==1;
togglepref(INT,"navigator.doNotTrack",0,1);
}
It is necessary to create a preference INT 'navigator.doNotTrack', or in the
root\defaults\pref create a file doNotTrack.js
pref("navigator.doNotTrack",1);
Regards
Re: Value type for single digit number in registry
I seem to not have follow instructions correctly, I guess. In any case, I am not getting a correct header.
I did as follows:
1. I made a new donottrack.js file by coping your updated code from your post. I put that in root\components folder.
2. I created donottrack.kmm file by copying your code. I put that in my user macro folder.
3. I created a donottrack.js file in root\defaults with the line to set the pref to 1.
The menu works, and my configuration file has the "navigator.doNotTrack" value as set by the last menu change. I have confirmed that the menu changes the value.
Indeed, it's good to know that you are the creator of the latest km beta. Well, probably is registry better way for you :)
Maybe this package can help that you learn something. Good luck with coding.