-
Notifications
You must be signed in to change notification settings - Fork 358
Description
Currently the browser makes a number of decisions about what network requests are high priority vs low priority. We could expose this as a Request.priority
attribute.
In addition, we could allow script to set this so that authors can hint that some requests are low priority. For example, think of a requestIdleCallback()
that is intended to avoid interfering with normal page operation, but it needs a network request. It could use a "low" priority.
Another use case would be pre-caching resources at a low priority in a ServiceWorker's install event handler. This would reduce any impact to the currently displayed page.
I don't think we would want to guarantee honoring the value, though. It would be a hint and best effort by the browser.
Webidl sketch:
interface Request
{
readonly attribute RequestPriority priority;
};
dictionary RequestInit
{
RequestPriority priority;
};
enum RequestPriority { "low", "normal", "high" };
Service workers would also be able to inspect priority:
addEventListener('fetch', evt => {
if (evt.request.priority === 'high') {
// high priority request
}
});