W3C validation fails due to CF

Cloudflare unfortunately modifies tags with invalid type tag.

Here is my original html:

<script src="js/myscript.js" type="text/javascript"></script>

Cloudflare, however, makes this into something like:

<script src="js/myscript.js" type="6e0e156949dd8b1694614bc1-text/javascript"></script>

The problem is that 6e0e156949dd8b1694614bc1-text/javascript is not a valid value for the type field. It should just be “text/javascript” as in the original html. In turn, W3C validation fails with an error:

Error: A script element with a src attribute must not have a type attribute whose value is anything other than the empty string, a JavaScript MIME type, or module.

Is it possible for Cloudflare to change the scripts to something like:

<script src="js/myscript.js" type="text/javascript" data-cf-someid="6e0e156949dd8b1694614bc1"></script>

In case you need to validate your HTML at http://validator.w3.org , kindly try disabling the “Rocket Loader” option at your Cloudflare dashboard.

1 Like

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.