Tag Archives: JavaScript

Fixing broken sites in the browser

The new Opera 8.0.1 includes an experimental feature called Browser JavaScript. It’s a collection of client-side scripts that automatically corrects known errors on websites as they’re displayed. Opera downloads updated scripts once a week.

It’s an extension of the User JavaScript concept. Firefox’s Greasemonkey is basically the same thing, and it’s gotten a lot of attention as a method for correcting or enhancing sites. The key difference is that these scripts are centrally maintained, and automatically updated.

Browser JavaScript is disabled by default, and can be turned on by putting Browser JavaScript=1 in the [User Prefs] section of your opera6.ini file.

(via Opera Watch)

Posted in Opera | Tagged , , , , | 1 Comment

Focus!

While working on a website for work, I inadvertently discovered why a web application I use frequently has the annoying habit of moving the cursor to the username field when I’m halfway through typing the password.

The basic way to set initial focus on a form field is to use JavaScript like this:

document.loginForm.usernameField.focus();

You can either embed it in the HTML after the form, or call it in the page’s onload() function. The problem with using onload is that it fires when everything is loaded, which means it waits for images, plugins, and so on. That’s very useful for some tasks, but isn’t the best choice here.

I’m impatient, especially with login forms. I don’t need the logos and background, I want to type in my username and password as quickly as possible and start using the app. Since this particular site isn’t exactly the fastest around, invariably the images don’t finish loading until I’ve started typing the password — and suddenly I’m typing the second half of the password in the username box.

Needless to say, I’m using the inline method on the site I’m building. Not that the login page has any images right now, but if I add any later on, it’ll save the users some aggravation.

Posted in Annoyances, Troubleshooting, Web Design | Tagged , | Leave a comment