W3C home > Mailing lists > Public > whatwg@whatwg.org > October 2014

[whatwg] HTML imports: relative URLs in blobs / progress events

From: Ashley Gullen <ashley@scirra.com>
Date: Mon, 20 Oct 2014 18:42:18 +0100
Message-ID: <CAABs73h9v7hzYimY_5qh35o6Q3CLv=2BL_ozdabj6wTG=WDLHQ@mail.gmail.com>
To: "whatwg@lists.whatwg.org" <whatwg@lists.whatwg.org>
Hi all,

I'd like to suggest a use case whereby it would be useful if a blob import
can load relative URLs as if they are relative to the importing HTML
document. Alternatively HTML imports could provide progress events. This
suggestion comes from a discussion on a Chrome bug [1].

A complex webapp might use a very large HTML import, particularly if
compiled with a tool like polymer's vulcanize [2]. A normal HTML import
does not provide any progress feedback (as far as I am aware). Users on
slow connections e.g. EDGE will remain unaware of any progress until
suddenly the entire HTML import has loaded, which could be after some time.

One way to get progress events is to AJAX request the import as a string.
Progress events can be received on the AJAX request to keep a waiting user
informed of progress. When the response completes, a blob is created from
the response text, a URL created to the blob, and then an import inserted
pointing to the blob URL. (The URL in the bug report demonstrates this.)
However as discussed in the bug report this fails to load relative URLs,
which I think is currently spec-compliant since blobs are a sort of
standalone resource with no path.

In other words a relative load like this:

<script src="foo.js"></script>

will load correctly with a normal HTML import, but from the blob import
does not reference anything and therefore fails to load. Therefore it is
not possible to simply swap a normal HTML import for an AJAX request; the
HTML import may have to be modified.

There are two ways this could be solved:
1. Allow blob-URL HTML imports to load relative URLs as if they were
relative to the parent document.
2. Provide progress events on HTML imports.

Does one of these options sound preferable to the other? Should I file a
spec bug and if so for which option and under which spec?

[1] https://code.google.com/p/chromium/issues/detail?id=422620
[2] https://github.com/polymer/vulcanize
Received on Monday, 20 October 2014 17:42:44 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 17:00:24 UTC