Page 1 of 1

JavaScript files blocked because of MIME type mismatch

Posted: Wed Jul 03, 2024 5:11 pm
by Frank Ralf
Hi,

One of our customers delivers the Oxygen WebHelp output via a WordPress site. However, all the JavaScript from the WebHelp is blocked by the browser with the following error message:

The resource from “https://docs.mydomain.de/pub/setclip/ah ... 2024041900” was blocked due to MIME type (“text/plain”) mismatch (X-Content-Type-Options: nosniff).

According to Resource blocked due to MIME type mismatch (X-Content-Type-Options: nosniff) this is because the server sets the content type of the JavaScript files to text/plain instead of text/javascript. Is this something that can be fixed on WebHelp level? Or is this a server configuration?

Best regards,
Frank

EDIT
Looks as if the script tags that include the JavaScript files are missing the type-attribute compared to the CSS files:

Code: Select all

<script src="./oxygen-webhelp/app/options/properties.js"></script>

<link rel="stylesheet" type="text/css" href="./oxygen-webhelp/app/main.css" />

Re: JavaScript files blocked because of MIME type mismatch

Posted: Thu Jul 04, 2024 4:50 pm
by beniamin_savu
Hi,

Thank you for your feedback!

Please note that omitting the type attribute indicates that the script is considered a classic script, interpreted as JavaScript. For more details on the type attribute, refer to the following sources: :
* https://html.spec.whatwg.org/multipage/ ... cript-type
* https://developer.mozilla.org/en-US/doc ... _mime_type

Setting the MIME type for a file is most likely associated with the server configuration settings. Unfortunately we don't think it can be adjusted directly from WebHelp.

Best regards,
Beniamin Savu
Oxygen WebHelp Team
http://www.oxygenxml.com

Re: JavaScript files blocked because of MIME type mismatch

Posted: Thu Jul 04, 2024 6:18 pm
by Frank Ralf
Thanks for your quick reply!

Best regards,
Frank

Re: JavaScript files blocked because of MIME type mismatch

Posted: Tue Jul 09, 2024 11:16 am
by Frank Ralf
The customer changed the server settings to recognize JS files in addition to HTML and CSS and now it works.

Best regards,
Frank