files/en-us/web/http/reference/headers/speculation-rules/index.md
{{SeeCompatTable}}
The HTTP Speculation-Rules {{Glossary("response header")}} provides one or more URLs pointing to text resources containing speculation rule JSON definitions. When the response is an HTML document, these rules will be added to the document's speculation rule set. See the Speculation Rules API for more information.
The resource file containing the speculation rules JSON can have any valid name and extension, but it will be requested with a destination type of speculationrules, and must be served with an application/speculationrules+json MIME type.
<table class="properties"> <tbody> <tr> <th scope="row">Header type</th> <td>{{Glossary("Response header")}}</td> </tr> </tbody> </table>[!NOTE] This mechanism provides an alternative to specifying the JSON definition inside an inline
<script type="speculationrules">element. Specifying an HTTP header is useful in cases where developers are not able to directly modify the document itself.
Speculation-Rules: <url-list>
<url-list>
<script type="speculationrules"> elements. See Speculation rules JSON representation for the syntax reference.The following response contains one file reference:
Speculation-Rules: "/rules/prefetch.json"
The following response contains multiple file reference as a comma-separated list:
Speculation-Rules: "/rules/prefetch.json","/rules/prerender.json"
[!NOTE] The URL values must be contained in quotes.
{{Specifications}}
{{Compat}}