这是indexloc提供的服务,不要输入任何密码
Skip to content

Allow external <script type=speculationrules> #348

@bramus

Description

@bramus

I’m building a project that is a bunch of plain HTML files with plain CSS and JS – there is no build step. I’m deploying this project to a server where I cannot control the headers being sent.

Because I can’t control the headers, I needed to add Speculation Rules by adding the following snippet to each and every HTML file:

<script type="speculationrules">
	{
		"prerender": [{
			"source": "document",
			"where": {
				"href_matches": "/*"
			},
			"eagerness": "moderate"
		}]
	}
</script>

This is very repetitive. I kinda assumed I would be able to do the following to keep things DRY, but turns out this is not possible:

<script type="speculationrules" src="file-with-speculation-rules.json"></script>

Hereby requesting to consider this feature request.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestspeculation rulesRelated to speculation rules (syntax, semantics) other than the requested action

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions