Initial focus in Chrome
I’ve seen numerous posts related to focus, but have not found a solution as yet. Any help is appreciated.
Scenario I have an ASP.NET web page with a user name and password input control. I pre-load the user name input from AD and want to set initial focus to the password field. This work great in IE, but no matter what I’ve tried with Chrome, it won’t set focus to the password field when the page initially loads. Initial focus is always in the Chrome address bar. If I press the enter key to postback the page, focus to the password input works correctly.
What I’ve done so far in a document.ready event, I make a call to the setInterval function with a delay of 500ms. The function called gets a reference to the password input and calls focus. I’ve changed the delay all the way up to 1000ms, but still no focus.
I’ve also tried setting the tabindex on the password input to 0 or 1.
It’s like there is some internal function in Chrome that waits until everything is complete in your page and then sets focus to the address bar.