最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - how to resolve Cross-Origin Read Blocking (CORB) blocked cross-origin response <URL> - Stack Overflow

programmeradmin1浏览0评论

I'm retrieving images URL from my firebase database and then using URLs to dipslay the image in my page

The problem is that i'm getting this error (PS i'm using images URL from wikipedia)

Cross-Origin Read Blocking (CORB) blocked cross-origin response (magazine) with MIME type text/html. See  for more details.
Cross-Origin Read Blocking (CORB) blocked cross-origin response <URL> with MIME type text/html. See <URL> for more details.

this is my code :

 var databaseRef = firebase.database().ref('titres/');
        databaseRef.once('value' , function(snapshot) {
        snapshot.forEach(function(childSnapshot) {
        var childKey = childSnapshot.key;
        var childData = childSnapshot.val();
        const list = document.getElementById('favoris');
        [childSnapshot].forEach(item => {
          // add title as an option in the select tag 
            var table = document.getElementById("myTable");
              var row = table.insertRow(0);
              var cell1 = row.insertCell(0);
              var cell2 = row.insertCell(1);
               let img = document.createElement('IMG');
               cell2.innerHTML=item.val().nom;
               if (item.val().URL_logo != undefined && item.val().URL_logo !="" && item.val()!=undefined &&  item.val().URL_logo !=" " )
               {  console.log(item.val().nom)  
                  console.log(item.val().URL_logo)

                    img.src=item.val().URL_logo ;
                    img.height="42"
                    img.width="100"
                    cell1.appendChild(img)

               }
               else{ cell1.innerHTML=item.val().nom;}

Any ideas how to fix this ?

I'm retrieving images URL from my firebase database and then using URLs to dipslay the image in my page

The problem is that i'm getting this error (PS i'm using images URL from wikipedia)

Cross-Origin Read Blocking (CORB) blocked cross-origin response https://fr.wikipedia/wiki/Capital_(magazine) with MIME type text/html. See https://www.chromestatus./feature/5629709824032768 for more details.
Cross-Origin Read Blocking (CORB) blocked cross-origin response <URL> with MIME type text/html. See <URL> for more details.

this is my code :

 var databaseRef = firebase.database().ref('titres/');
        databaseRef.once('value' , function(snapshot) {
        snapshot.forEach(function(childSnapshot) {
        var childKey = childSnapshot.key;
        var childData = childSnapshot.val();
        const list = document.getElementById('favoris');
        [childSnapshot].forEach(item => {
          // add title as an option in the select tag 
            var table = document.getElementById("myTable");
              var row = table.insertRow(0);
              var cell1 = row.insertCell(0);
              var cell2 = row.insertCell(1);
               let img = document.createElement('IMG');
               cell2.innerHTML=item.val().nom;
               if (item.val().URL_logo != undefined && item.val().URL_logo !="" && item.val()!=undefined &&  item.val().URL_logo !=" " )
               {  console.log(item.val().nom)  
                  console.log(item.val().URL_logo)

                    img.src=item.val().URL_logo ;
                    img.height="42"
                    img.width="100"
                    cell1.appendChild(img)

               }
               else{ cell1.innerHTML=item.val().nom;}

Any ideas how to fix this ?

Share Improve this question edited Mar 12, 2019 at 14:06 Quentin 945k132 gold badges1.3k silver badges1.4k bronze badges asked Mar 12, 2019 at 13:40 Az EmnaAz Emna 5352 gold badges12 silver badges26 bronze badges 3
  • 2 The errors mean that the responses are text/html instead of an image media type, so the browser blocks them as a security precaution. – Pointy Commented Mar 12, 2019 at 13:44
  • 1 chromium/Home/chromium-security/corb-for-developers – epascarello Commented Mar 12, 2019 at 13:44
  • 1 It's generally considered fairly impolite to leech images from somebody else's domain. – Pointy Commented Mar 12, 2019 at 13:49
Add a ment  | 

1 Answer 1

Reset to default 4

When you set the src for the image, you need to use a URL which points to an actual image.

You appear to be using URLs to Wikipedia HTML documents instead.

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论