question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

JQuery example: Nosniff on FF, strict MIME on Chrome

See original GitHub issue

First of all, thanks, I’m starting to discover how great is your module! I try it on a ROCK64 o nthe LAN.

Software and Package Versions

Software Version
Node.JS v13.2.0
npm 6.13.1
Node-RED 1.0.3
uibuilder node 2.0.6
uibuilderFE ??
OS DietPi (Debian), Raspberry ARM64 4GB RAM
Browser Win10, FF 70.0.0.1, Chrome 78.0.3904.108 (Official Build) (64-bit)

How is Node-RED installed? Where is uibuilder installed?

dietpi-software, to get node-red as a service uibuilder installed using the Node-Red Palette

Uibuilder default Vue is working fine but when I imported JQuery example then pasted html, css and js from https://github.com/TotallyInformation/node-red-contrib-uibuilder/wiki/Example:-JQuery /jq correctly throws:

 Welcome to UIbuilder for Node-RED
This is an example of using uibuilder with jQuery.
...

but the Console of firefox sents:

La ressource à l’adresse « http://192.168.1.25:1880/uibuilder/vendor/normalize.css/normalize.css » a été bloquée en raison d’un type MIME (« text/html ») incorrect (X-Content-Type-Options: nosniff).
jq
La ressource à l’adresse « http://192.168.1.25:1880/uibuilder/vendor/jquery/dist/jquery.min.js » a été bloquée en raison d’un type MIME (« text/html ») incorrect (X-Content-Type-Options: nosniff).
jq
La ressource à l’adresse « http://192.168.1.25:1880/uibuilder/vendor/normalize.css/normalize.css » a été bloquée en raison d’un type MIME (« text/html ») incorrect (X-Content-Type-Options: nosniff).
jq
La ressource à l’adresse « http://192.168.1.25:1880/uibuilder/vendor/jquery/dist/jquery.min.js » a été bloquée en raison d’un type MIME (« text/html ») incorrect (X-Content-Type-Options: nosniff).
jq
Échec du chargement pour l’élément <script> dont la source est « http://192.168.1.25:1880/uibuilder/vendor/jquery/dist/jquery.min.js ». jq:52:1
ReferenceError: $ is not defined

and Chrome

192.168.1.25/:1 Refused to apply style from 'http://192.168.1.25:1880/uibuilder/vendor/normalize.css/normalize.css' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.
jquery.min.js:1 Failed to load resource: the server responded with a status of 404 (Not Found)
index.js:24 Uncaught ReferenceError: $ is not defined
    at index.js:24
init.js:298 autorefresh_option true
192.168.1.25/:1 Refused to apply style from 'http://192.168.1.25:1880/uibuilder/vendor/normalize.css/normalize.css' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.

But I double checked the file MIME type in uibuilder is fine: image

Any idea?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
j2lcommented, Nov 26, 2019

Oh, I see. I added jquery but thought normalize.css was a css sheet, not a package. Thank you again @TotallyInformation It works without error now 😃

0reactions
TotallyInformationcommented, Nov 25, 2019

I only pasted your code

Yes, it was incorrect I’m afraid. It used to work but some update of Node-RED/ExpressJS tightened up the rules it seems. It is now corrected.

Because normalize.css is nowhere on the disk

You will need to install the normalize package or use it from a CDN. You can use the package manager built into uibuilder to install it if you want to.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Disable Chrome strict MIME type checking - Stack Overflow
Refused to execute script from 'https://example.com' because its MIME type ('text/plain') is not executable, and strict MIME type checking is enabled. Its ...
Read more >
Strict MIME type checking prevents JavaScript served as 'text ...
Refused to execute script from 'http://github.com/jquery/jquery-tmpl/raw/master/jquery.tmpl.js' because its MIME type ('text/plain') is not executable, and ...
Read more >
X-Content-Type-Options - HTTP - MDN Web Docs - Mozilla
Directives. nosniff. Blocks a request if the request destination is of type style and the MIME type is not text ...
Read more >
scripts cannot be loaded due to incorrect mime type
Refused to execute script because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
Read more >
Refused to execute script from '<<URL/jquery-3.3.1.min.js ...
Due to strict MIME type checking at server {'name':'X-Content-Type-Options','value':'nosniff'}, 'jquery.min.js', 'moment.min.js' and ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found