强制浏览器在 HTTP 请求中使用特定的 Accept 字段

Force browser to use specific Accept field in HTTP request

是否可以强制网络浏览器在 html 请求中使用特定的 MIME 类型?

<a type="application/pdf" href="https://url.com/">PDF</a><a type="text/html" href="https://url.com/">HTML</a> 所以浏览器在接受字段中两次请求 text/html。

您唯一可以控制请求 headers 的时间是使用 XMLHttpRequest 或 Fetch 发出请求时。

使用不同的 URL 可以更好地解决这个问题。

例如

<a href=“http://example.com/example.pdf”>PDF</a>
<a href=“http://example.com/example”>HTML</a>