473,395 Members | 2,795 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

user.js doesn't work

kj

I don't know what I'm doing wrong.

I have a file called user.js in my Mozilla (or Firefox) directory,
and this file contains the following code:

user_pref("browser.throbber.url", "http://news.google.com/");

function foo() {
alert("foo");
}

And yet, when I start Mozilla (or Firefox), and look at the listing
from about:config, I see that browser.throbber.url is still set to
the default value (e.g. http://www.mozilla.org/products/firefox/start),
not the value I set it to in user.js. Similarly, if I type the
following in the location bar:

javascript:foo()

I get the error "Error: foo is not defined" in the JavaScript
console. I've tried this both on Windows and on Linux. On Windows,
the user.js file is in

Documents and Settings > yourstruly > Application Data
Mozilla > Firefox > Profiles > default###


and the one on Linux it is in

~/.mozilla/yourstruly/###.slt

What am I doing wrong?

kj

--
NOTE: In my address everything before the first period is backwards;
and the last period, and everything after it, should be discarded.
Jul 23 '05 #1
1 2270
kj wrote:
I don't know what I'm doing wrong.

I have a file called user.js in my Mozilla (or Firefox) directory,
and this file contains the following code:

user_pref("browser.throbber.url", "http://news.google.com/");

function foo() {
alert("foo");
}

And yet, when I start Mozilla (or Firefox), and look at the listing
from about:config, I see that browser.throbber.url is still set to
the default value (e.g. http://www.mozilla.org/products/firefox/start),
not the value I set it to in user.js. Similarly, if I type the
following in the location bar:

javascript:foo()

I get the error "Error: foo is not defined" in the JavaScript
console. I've tried this both on Windows and on Linux. On Windows,
the user.js file is in

Documents and Settings > yourstruly > Application Data
> Mozilla > Firefox > Profiles > default###


and the one on Linux it is in

~/.mozilla/yourstruly/###.slt

What am I doing wrong?

kj


prefs.js seems to be the file that contains the customized values, not
user.js. I've seen all sorts of references to "user.js" on the Web, but all
_my_ customized about:config values are coming from prefs.js, not user.js.
*Maybe* user.js in the "chrome" directory under the profile would do what
you want, I can't be bothered testing it when changes to prefs.js do what I
want.

As for why your custom function isn't working, I have no idea. My guess is
it's a scope issue. The contents of prefs.js do not execute in the same
namespace/scope as regular scripts in the browser. If prefs.js were in the
same namespace/scope, you could run "javascript:user_pref(...)" in the
Address Bar, which I just tested, and does not work.

--
Grant Wagner <gw*****@agricoreunited.com>
comp.lang.javascript FAQ - http://jibbering.com/faq
Jul 23 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Spam sucks | last post by:
Hello, If somebody could help me with this one it would be very nice, the story: I need to check if a user is online or not at the moment i am doing a user logoff with javascript but this is...
60
by: Fotios | last post by:
Hi guys, I have put together a flexible client-side user agent detector (written in js). I thought that some of you may find it useful. Code is here: http://fotios.cc/software/ua_detect.htm ...
5
by: Henke | last post by:
I added a project to my solution that contains a user control. Now I 'd like to add the user control from that project to a form in my solution. The problem is that the control doesn't gets added...
88
by: Mike | last post by:
Is there a way to determine what a user's default email client is? I read a post from 3 years ago that said no. I guess I'm hoping something has come along since then.
5
by: Henke | last post by:
Hi! I add some web user controls dynamicly with: myPanel.Controls.Add(Page.LoadControl("MyDynamiclyAddedPage.ascx")); the style of the controls on the user control is set from a css-class, by...
7
by: jsale | last post by:
I'm currently using ASP.NET with VS2003 and SQL Server 2003. The ASP.NET app i have made is running on IIS v6 and consists of a number of pages that allow the user to read information from the...
4
by: James | last post by:
I have a VB windows forms application that accesses a Microsoft Access database that has been secured using user-level security. The application is being deployed using No-Touch deployment. The...
1
by: James | last post by:
I have a VB windows forms application that accesses a Microsoft Access database that has been secured using user-level security. The application is being deployed using No-Touch deployment. The...
24
by: Rob R. Ainscough | last post by:
VS 2005 I have: ClickOnce deployment User's that hate and or don't want to use an IE Client (don't blame them) I don't see how ASPX web pages are going to survive? With .NET 2.0 and clickonce...
5
by: Segfahlt | last post by:
I need a little help here please. I have 2 win forms user controls in 2 different projects that I'm hosting in 2 different virtual directories. The controls have been test and operate okay in...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.