Skip to content
EPUBCheck · Resources and references

EPUBCheck RSC-034: script without JS media type

Updated:

EPUBCheck RSC-034 is an error message: “Scripts must have a JavaScript media type.” A script is declared with a media type that is not a JavaScript media type. EPUB 3.3 lists application/javascript, application/ecmascript and text/javascript as the core media types for scripts.

The official message

Scripts must have a JavaScript media type.

Default severity
Error. The EPUB breaks a rule of the specification and is invalid. Stores and Send to Kindle may reject it, and EPUBCheck exits with status 1.
EPUBCheck version
5.4.0

Typical causes

  • A manifest item for a .js file with a wrong media-type, such as text/plain or application/x-script.
  • A script element whose type attribute names something other than JavaScript.

How to fix it

  1. Find the script named in the message.
  2. Set the media type to text/javascript in the manifest item and in the script element's type attribute (or remove type on script elements, which defaults to JavaScript).
  3. Validate again.

When it's not this

An older JavaScript media type that still works only gives the usage message RSC-035.

Terms used here

Other RSC messages

  • RSC-033 Relative URL strings must not have a query component, but found one in "…".
  • RSC-035 "…" is a legacy media type for JavaScript. Consider using 'text/javascript' instead.
  • RSC-032 Fallback must be provided for foreign resources, but found none for resource "…" of type "…".
  • RSC-031 Remote resource references should use HTTPS, but found "…".
  • RSC-030 File URLs are not allowed in EPUB, but found "…".
  • RSC-029 Data URL is not allowed in this context.

Sources

Message text and severity from EPUBCheck 5.4.0 (W3C, BSD-3-Clause). Explanation by EpubCC.

FAQ

What does EPUBCheck RSC-034 mean?

EPUBCheck RSC-034 is an error message: “Scripts must have a JavaScript media type.” A script is declared with a media type that is not a JavaScript media type. EPUB 3.3 lists application/javascript, application/ecmascript and text/javascript as the core media types for scripts.

Is RSC-034 an error?

RSC-034 is reported as error by default. The EPUB breaks a rule of the specification and is invalid. Stores and Send to Kindle may reject it, and EPUBCheck exits with status 1.