whatwg / xhr

XMLHttpRequest Standard
https://xhr.spec.whatwg.org/
Other
314 stars 131 forks source link

Support for referrerPolicy #297

Closed HarmonT closed 3 years ago

HarmonT commented 3 years ago

Fetch already supports setting referrerPolicy. But as you know, Fetch is not always a better API than XHR for AJAX, such as progress updating, etc. So adding support for referrerPolicy in XHR will be helpful.

So far I can only come up with an ugly workaround to support standalone referrerPolicy for every XHR request ---- just create a tag <meta name="referrer" content="{any referrerPolicy you want}">, and insert it into DOM before sending an XHR request, then remove this <meta> to clean up. But the global Referrer-Policy setting of the page will not be restored as it was after the <meta> being removed. I tested it on Chrome 87.

annevk commented 3 years ago

We're not adding new features to XMLHttpRequest. FetchObserver is still something we plan to add to fetch() to address that shortcoming.