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

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