juliangarnier / anime

JavaScript animation engine
https://animejs.com
MIT License
49.63k stars 3.67k forks source link

Refusal for Execution #883

Open Quatromic opened 7 months ago

Quatromic commented 7 months ago

As I paste in the script page to use the library in my html file.An error pops up that says exactly this: ' Refused to execute http://127.0.0.1:5500/anime.min.js as script because "X-Content-Type-Options: nosniff" was given and its Content-Type is not a script MIME type. '

This error simply pops up as soon as you paste in the script link tag towards the library I honestly expected It to work but even the (anime) call simply failed to work

Here is a screenshot of exactly what I'm seeing on my side

screenshot 2024-02-09 at 22 48 22

I'm currently using a MacBook laptop and I use Safari as let's say my default browser Version 17.3.1

If I'm the one wrong on my side. A simple explanation to the resolution of my problem would be much appreciated.

Regards, Quatromic

different55 commented 7 months ago

You need to set the proper Content-Type headers for whatever software is serving up your files on port 5500. It's not an anime.js issue, if you try even a super basic script you'll probably find you can't get any JS running. It seems like you might be using VSCode live server, I'd check out their documentation or any FAQs for answers.

Quatromic commented 7 months ago

You need to set the proper Content-Type headers for whatever software is serving up your files on port 5500. It's not an anime.js issue, if you try even a super basic script you'll probably find you can't get any JS running. It seems like you might be using VSCode live server, I'd check out their documentation or any FAQs for answers.

How would I do that? and yes I am using live server in VS Code.

different55 commented 7 months ago

I really can't say for certain, I can only tell you that that's the direction your answer's in. Find out why Live Server is serving your script files as something other than text/javascript, and you'll have found out why it's not working.

Or ignore the problem and link to a CDN-hosted copy of anime.js. Won't have any issue with MIME types that way.

Quatromic commented 7 months ago

I really can't say for certain, I can only tell you that that's the direction your answer's in. Find out why Live Server is serving your script files as something other than text/javascript, and you'll have found out why it's not working.

Or ignore the problem and link to a CDN-hosted copy of anime.js. Won't have any issue with MIME types that way.

Alright, thanks for your help @different55 ,I'll inform when I get the problem's solution.

Cheers, Quatromic