Description
The value of Sec-Fetch-Mode
should tell the server how its response will be used, specifically: if it is navigate
or nested-navigate
then the server should expect the response will render, and if it's something else (e.g. no-cors
or cors
) it will be used as a resource.
The problem is that the <embed>
and <object>
tags can load both resources (plugins, images) and renderable documents. At the time of sending the request the browser does not know the MIME type of the response so cannot guarantee to the server that it will not treat the response as HTML.
This can be a problem for developers who would like to restrict navigations (e.g. to mitigate the exploitation of XSS or as a server-side equivalent to X-Frame-Options
) without restricting subresource loads; in that case, the server will see a no-cors
load and will not have enough information to be able to reject such requests. This could potentiality be solved by Sec-Fetch-Dest
but its status is not clear-cut. We should figure this out.
Examples:
https://arturjanc.com/fetch-metadata-hackit/iframe-embed-test.html
https://arturjanc.com/fetch-metadata-hackit/iframe-object-test.html