Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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...

share|improve this question

migrated from stackoverflow.com Nov 4 '09 at 14:47

This question came from our site for professional and enthusiast programmers.

    
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 '09 at 16:00
1  
@Josh K, I use the up-down arrow keys for scrolling, and auto focusing of text input totally breaks that. –  sayap Jul 7 '13 at 1:50

2 Answers 2

"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"

Josh K - How come every time someone asks how to do something on the internet there is a "why would you want to do that?" comment by a person like you? What value have you added here?

Is it so hard for you to accept that you don't have all the answers that you have to assume the question itself is flawed?

Or maybe you believe you do have all the answers and if people don't do things exactly the way you do them they must be doing things wrong.

Perhaps you just have some pathological need to put your worthless input into everything.

Regardless of the reason, on behalf of all the other people who came to this page looking for the answer to the initial question, thanks for nothing.

Anyway, if you're using firefox you can use the NoScript plugin which is kinda like killing ants with a sledgehammer or you can try this greasemonkey script:

// ==UserScript==
// @name           Stop Google Stealing Focus
// @namespace      http://googlesystem.blogspot.com
// @include        http://www.google.*/
// @include        http://www.google.*/ig*
// ==/UserScript==

(function () {
    document.body.setAttribute('onload',''); 
})();

That works for me - who knows if it has any other side-effects though.

share|improve this answer

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.

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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