MIME type of JavaScript file wrong

Hello there,

I have a JavaScript file located on my Seafile server that I want to include as a script in a web app.
I’m using a link activated in Seahub.
However, my browser is not accepting it mentioning that it has the wrong MIME type (‘application/octet-stream’).
So is there anything that you can configure such that it sends the right MIME type?
(By the way, it’s working for other file types like .PNG)

It works as designed. For security it should not be possible to execute JavaScript shared by users.

1 Like

There’s way to link it over webdav. But you have to create something like public user. Share library with him and read-only access (in these step be carefull). There is HTTP Basic authentication for access webdav so you have to add credentials into link (this is why you have to be carefull what you are sharing with your public user and how much permissions you give him).

<link rel="stylesheet" href="https://public_user:password@seafile.example.cz/seafdav/Styles/main.js" />

For clear this. I’m not recommending this way to you, just providing solution.

Afaik writing credentials this way has been deprecated and is going to stop working at least in Chrome.

See https://developers.google.com/web/updates/2017/02/chrome-57-deprecations#deprecate_support_for_embedded_credentials_in_subresource_requests and discussion at https://groups.google.com/a/chromium.org/forum/#!topic/blink-dev/lx-U_JR2BF0

1 Like

Thanks for info, didn’t notice that.