vote up 1 vote down star

Is there any Firefox extension or built in configuration that will allow disabling onload focusing in text fields?

I do not want to disable javascript. I'm just sick of certain sites auto-focusing in their search box when I have no intention of searching.

The annoyance is that if I'm interacting with a toolbar, or anything else, the focus instantly goes to the search box. Which then requires me to mouse back to the toolbar or whatever else I was doing.

Normally I wouldn't consider this to be a problem. But generally it goes: open new tab, click in toolbar, start typing. Half way through the page finishes loading, and half of what I typed is now in the search box and not the toolbar. Happens about 200 times a day...

flag
Why do you care if they automatically give focus to a search box? You said it yourself, you're not searching simply browsing. Unless you plan on typing as soon as you hit the page I would think auto focus wouldn't be an issue. – Josh K Nov 4 at 16:00

migrated from stackoverflow.com

1 Answer

vote up 0 vote down

I do not know of anything specific, but as greasemonkey scripts run as soon as the DOM is populated but before the onload event handlers are called (as stated in http://greasemonkey.mozdev.org/authoring.html) you could write a script that disabled, or changed, the onload event for the sites you want the behaviour removed from.

You would have to do this on a per-site basis though, as some sites will do more than just refocus during the onload event and you probably want the other behaviour to run.

This also won't work for sites that do the refocus directly while the page is rendering (by calling the focus method directly in a <SCRIPT> block instead of in code called by the onload event.

It might be worth searching http://userscripts.org/ to see if there are any existing scripts there for the sites you want to change the behaviour of.

link|flag
1  
Nice idea, but some libraries (jQuery) run scripts as soon as the DOM is ready. $(document).ready(function(){}); – Josh K Nov 4 at 15:59

Your Answer

Get an OpenID
or
never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.