Skip to main content
HTML Validation

A “script” element with a “type” attribute whose value is neither a JavaScript MIME type, “module”, “importmap”, nor “speculationrules” (i.e., a data block) must not have a “fetchpriority” attribute.

About This HTML Issue

The fetchpriority attribute is invalid on a <script> element whose type marks it as a data block, because the browser never downloads a data block and has no request to prioritize.

When the type attribute is anything other than a JavaScript MIME type, module, importmap, or speculationrules, the browser treats the element as a data block: inline content that other scripts on the page can read, but that never runs. JSON-LD structured data in type="application/ld+json" is the most common example.

fetchpriority takes high, low or auto and tells the browser how urgently to download an external script compared with other resources on the page. A data block can't have a src and the browser never requests it, so the hint has nothing to apply to.

The markup is often valid when the server sends it. Some script optimizers rewrite the type so the browser skips the script on load, then run it later with their own loader. Cloudflare Rocket Loader, for example, turns type="module" into a prefixed value such as type="a1b2c3d4-module". The validator checks the rewritten markup, finds an unknown type, and reports the fetchpriority and src attributes as well as the type value itself.

Invalid example

<script type="a1b2c3d4-module" src="/js/gallery.js" fetchpriority="low"></script>

Valid example

<script data-cfasync="false" type="module" src="/js/gallery.js" fetchpriority="low"></script>

data-cfasync="false" tells Rocket Loader to leave the script alone, so the browser receives the original type="module". Cloudflare requires it before the src attribute. Turning Rocket Loader off for the site also works.

If the element really is a data block, such as JSON-LD, remove fetchpriority from it. If it was meant to run and the type holds a typo, fix the type instead: use module, a JavaScript MIME type such as text/javascript, or leave type out.

Find issues like this automatically

Rocket Validator scans thousands of pages in seconds, detecting HTML issues across your entire site.

Help us improve our guides

Was this guide helpful?
🌍 Trusted by teams worldwide

Validate at scale.
Ship accessible websites, faster.

Automated HTML & accessibility validation for large sites. Check thousands of pages against WCAG guidelines and W3C standards in minutes, not days.

Scheduled Reports
API Access
Open Source Standards
€5 / week

1K Weekly

1,000 monthly checks. Cancel anytime.

Get 1K Weekly →

Join teams across 40+ countries