You are viewing this site as a guest. Join our community to get your questions answered and share knowledge. Active members may advertise and ask for a website critique.

Disable setfocus() in Firefox

pr0gr4mm3r's picture

He has: 1,420 posts

Joined: Sep 2006

I get really annoyed when web pages try to divert my cursor focus to a specific control, especially when I'm typing. Is their a way to disable functionality?

He has: 581 posts

Joined: May 2007

Use NoScript perhaps?

pr0gr4mm3r's picture

He has: 1,420 posts

Joined: Sep 2006

Yes, I looked at that extension, but I don't want to disable all JS on the page. I just want the setfocus() function to never work on any site I visit again.

pr0gr4mm3r's picture

He has: 1,420 posts

Joined: Sep 2006

Whoa...talk about SEO.

pr0gr4mm3r's picture

He has: 1,420 posts

Joined: Sep 2006

I guess I had the function wrong. It is the focus() function.

Here is a partial solution...adding this in the user.js file solves the issue.

user_pref("capability.policy.policynames", "nofocus");
user_pref("capability.policy.nofocus.sites", "http://agstesting.com");
user_pref("capability.policy.nofocus.HTMLInputElement.focus", "noAccess");

The only problem is that the sites has to be listed. Oh well. I only have a couple sites where is is especially annoying.

Greg K's picture

He has: 1,911 posts

Joined: Nov 2003

Here is a code hint for those programming:

On the script where you tell it to set focus once the page loads, CHECK your inputs to make sure nothing is already typed.

This is also a pet peeve of mine on my old bank's site. By the time the page finally loaded everything, I was usually already in the middle of typing my password and in would put me back in the username input, where guess what, I just submitted at least part of my password in the username field.

Thanks for the info on the user.js file, I'm going to look into that more to see what you can do in there.

-Greg

[This space intentionally left blank]

Cool Geek Supplies: www.ThinkGeek.com

He has: 581 posts

Joined: May 2007

I have to agree - pages that set focus on a form field are a major irritant. Most often I use the keyboard to scroll a page, and this set focus action means I have to reach for the mouse to click on the page first.

It makes sense for Google to do it though - you are unlikely to want to do anything other than fill in the search field. But why would you do this on a page full of reading matter?

More about user JavaScript at Wikipedia.

Cordially, David
--
delete from internet where user_agent="MSIE" and version < 8;