Re: DOMContentReady and focus() in Opera
- From: Conrad Lender <crlender@xxxxxxxxx>
- Date: Mon, 18 May 2009 11:13:16 +0200
On 18/05/09 10:29, Tim Down wrote:
On May 18, 4:05 am, RobG <rg...@xxxxxxxxxxxx> wrote:
Have you considered a belt-and-braces approach? Use both DOM ready
and onload. Have the onload listener check to see if the DOM ready
script has run, if not, set the focus. Do the same with DOM ready,
just in case it calls the listener after onload has run.
That's part of what I'm doing. The window load event is the last resort
if DOMContentReady and polling didn't return a "ready" state sooner.
That has the potential to annoy the user if there is enough time
between the DOM being "ready" and the page finishing loading for the
user to move the focus to a form input other than the first one and
start typing.
Each of the different ways to detect the DOM-is-ready state will cancel
the others, so the handler will only fire once.
Talking about DOMContentReady, that reminds me of something else: is it
was possible to detect whether window/load has already been fired? I was
using a script which did its setup in an onload handler. When this
script was injected at a later point (via <script> element or XHR/eval),
the handler obviously wouldn't be called. I this specific case I could
either "remember" that window/load has already been fired, or call the
included script's setup method directly after including it. Is there any
possibility to handle this if I only have control over the included
script? There's document.readyState, but I don't think that's supported
well enough.
- Conrad
.
- Follow-Ups:
- Re: DOMContentReady and focus() in Opera
- From: RobG
- Re: DOMContentReady and focus() in Opera
- References:
- DOMContentReady and focus() in Opera
- From: Conrad Lender
- Re: DOMContentReady and focus() in Opera
- From: RobG
- Re: DOMContentReady and focus() in Opera
- From: Tim Down
- DOMContentReady and focus() in Opera
- Prev by Date: Re: DOMContentReady and focus() in Opera
- Next by Date: Re: Web-page that *BOTH* changes current page + displays a Pop-up page from JavaScript
- Previous by thread: Re: DOMContentReady and focus() in Opera
- Next by thread: Re: DOMContentReady and focus() in Opera
- Index(es):
Relevant Pages
|