W3C home > Mailing lists > Public > whatwg@whatwg.org > April 2013

[whatwg] API to delay the document load event

From: Robert O'Callahan <robert@ocallahan.org>
Date: Wed, 24 Apr 2013 23:51:08 +1200
Message-ID: <CAOp6jLbA4okWbRnyrM1aj8ok1isCTD8sq9HeaxTWrk2+5_b=RQ@mail.gmail.com>
To: WHATWG <whatwg@whatwg.org>
Context: https://bugzilla.mozilla.org/show_bug.cgi?id=863499

Use-cases:
1) User-agents provide thumbnails of Web pages (e.g. desktop Firefox,
FirefoxOS and Safari do this). We want to avoid taking a thumbnail while
the application is incompletely loaded. The firing of the document load
event is not currently a reliable indicator since the application might
have ongoing load activities (e.g. IndexedDB transactions, Websocket
activity) that do not block the document load event.
2) User-agent has UI to distinguish pages that are in the process of
loading from pages that are fully loaded. As in use-case #1, relying on the
document load event as currently defined to transition the UI to the "fully
loaded" state may be inaccurate.

Proposal:
Give Web applications APIs to explicitly delay the document load event. In
particular, add a method "document.delayLoadEvent()" that causes the
document load event to be delayed until a corresponding
"document.stopDelayingLoadEvent()" method is called. Allow these to nest so
that the document load event is delayed until at least as many calls to
stopDelayingLoadEvent() have been made as there were calls to
delayLoadEvent().

Alternatives:
Applications can fake this already by triggering an invisible subresource
load of a URI that never returns any data and never ends, and cancelling
the load when they want to stop delaying the load event. That seems fragile
and ugly.

Rob
-- 
q“qIqfq qyqoquq qlqoqvqeq qtqhqoqsqeq qwqhqoq qlqoqvqeq qyqoquq,q qwqhqaqtq
qcqrqeqdqiqtq qiqsq qtqhqaqtq qtqoq qyqoquq?q qEqvqeqnq qsqiqnqnqeqrqsq
qlqoqvqeq qtqhqoqsqeq qwqhqoq qlqoqvqeq qtqhqeqmq.q qAqnqdq qiqfq qyqoquq
qdqoq qgqoqoqdq qtqoq qtqhqoqsqeq qwqhqoq qaqrqeq qgqoqoqdq qtqoq qyqoquq,q
qwqhqaqtq qcqrqeqdqiqtq qiqsq qtqhqaqtq qtqoq qyqoquq?q qEqvqeqnq
qsqiqnqnqeqrqsq qdqoq qtqhqaqtq.q"
Received on Wednesday, 24 April 2013 11:51:34 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:57 UTC