简体   繁体   English

跨域读取阻塞 (CORB) 阻止跨域响应 https://cdnjs.com/libraries/Chart.js

[英]Cross-Origin Read Blocking (CORB) blocked cross-origin response https://cdnjs.com/libraries/Chart.js

I want to use chart.js but im getting this error anyone willing to help me solve the problem?我想使用chart.js但我得到这个错误有人愿意帮我解决问题吗?

Cross-Origin Read Blocking (CORB) blocked cross-origin response https://cdnjs.com/libraries/Chart.js with MIME type text/html.跨域读取阻止 (CORB) 阻止了 MIME 类型为 text/html 的跨域响应https://cdnjs.com/libraries/Chart.js See https://www.chromestatus.com/feature/5629709824032768 for more details.有关详细信息,请参阅https://www.chromestatus.com/feature/5629709824032768

Here is my js.这是我的js。

const Chart = document.getElementById("lineChart");
console.log(Chart);

let lineChart = new Chart(Chart,{
  type: 'line',
  data: {
    labels: ["January", "February", "March", "April", "May", "June", "July"],
    datasets: [
        {
            label: "My First dataset",
            fill: false,
            lineTension: 0.1,
            backgroundColor: "rgba(75, 192, 192, 0.4)",
            borderColor: "rgba(75, 192, 192, 1)",
            borderCapStyle: 'butt',
            borderDash: [],
            borderDashOffset: 0.0,
            borderJoinStyle: 'miter',
            pointBorderColor: "rgba(75,192,192,1)",
            pointBackgroundColor: "#fff",
            pointBorderWidth: 1,
            pointHoverRadius: 5,
            pointHitRadius: 10,
            data: [65, 59, 80, 81, 56, 55, 40],
        }
    ]}
});

Thanks in advance!提前致谢!

Based on comment, You are importing the html page and not the js file.根据评论,您正在导入 html 页面而不是 js 文件。

Here is what you can do to resolve the issue.以下是您可以采取的措施来解决此问题。

After visiting https://cdnjs.com/libraries/Chart.js you can,访问https://cdnjs.com/libraries/Chart.js后即可,

  1. Select the version of build that you want. Select 您想要的构建版本。
  2. Select the type of asset that you want (Javascript / Stylesheet). Select 您想要的资产类型(Javascript / 样式表)。
  3. Click on '</>' to copy the script tag which can be pasted and used directly in your page.点击'</>'复制脚本标签,可以直接粘贴到你的页面中使用。

截图

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在JS控制台中修复“跨域读取阻止(CORB)阻止跨源响应”? - How to fix “Cross-Origin Read Blocking (CORB) blocked cross-origin response” in the JS console? 自 2019 年 3 月 5 日起,跨域读取阻塞 (CORB) 阻止了跨域响应 - Cross-Origin Read Blocking (CORB) blocked cross-origin response since 5th March 2019 ajax发布请求-跨域读取阻止(CORB)阻止了跨源响应CORS - ajax post request - cross-Origin Read Blocking (CORB) blocked cross-origin response CORS 跨域读取阻塞 (CORB) 阻止了跨域响应 - Cross-Origin Read Blocking (CORB) blocked cross-origin response "如何解决跨域读取阻塞 (CORB) 阻止的跨域响应<URL>" - how to resolve Cross-Origin Read Blocking (CORB) blocked cross-origin response <URL> 跨域读取阻止 (corb) 阻止了 mime 类型 text/html 的跨域响应 - cross-origin read blocking (corb) blocked cross-origin response with mime type text/html 获取 API 跨域读取阻止 (CORB) 阻止了 MIME 类型 text/html 的跨域响应 - Fetch API Cross-Origin Read Blocking (CORB) blocked cross-origin response with MIME type text/html Javascript设置src属性获取错误的动态值跨源读取阻塞(CORB)阻止了跨源响应 - Javascript setting dynamic values for src attribute getting error Cross-Origin Read Blocking (CORB) blocked cross-origin response 跨域读阻塞 (CORB) - Cross-Origin Read Blocking (CORB) CORB:JSFiddle 上的跨域读取阻塞 - CORB: Cross-Origin Read Blocking on JSFiddle
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM