How to Resolve CORS (access-control-allow-origin)?

How to Resolve CORS (access-control-allow-origin)?

  

I have to admit this is not Outsystems specific, but I've always wondered how to resolve this issue even before. 

I intend to use the Youtube IFRAME API, here's my code inside a Development\JS interface:

SyntaxEditor Code Snippet

"
   var tag = document.createElement('script');

      tag.src = 'https://www.youtube.com/watch?v=VIDE_ID';
      var firstScriptTag = document.getElementsByTagName('script')[0];
      firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);

      // 3. This function creates an <iframe> (and YouTube player)
      //    after the API code downloads.
      var player;
      function onYouTubeIframeAPIReady() {
        player = new YT.Player('player', {
          height: '390',
          width: '640',
          events: {
            'onReady': onPlayerReady,
            'onStateChange': onPlayerStateChange
          }
        });
      }
"

ERROR:

"Cross-Origin Read Blocking (CORB) blocked cross-origin response https://www.youtube.com/watch?v=hhZ5feVHy_w with MIME type text/html"


Can I resolve this using plain JS or is this a server-side issue?

Hello,

I am having a similar issue:

I have a landing page in which a news feed from another source is loaded (with a loadOnVisible).

It worked fine, until I added a regular pop in the landing page. 

After that, sometimes, randomly it seems, the content of the pop up gets blocked, complaining about the access control allow origin.

But I find it strange, since the news feed has this setup to allow all (*):

And strangely, it's the pop up (the information comes from the same domain as the app) that gets blocked.

Could it be the order of the load?

I added a header to the pop up (in preparation) with Access cointrol allow origin set to accept all that comes from the news feed domain.

Could this be a platform bug? There are two iframes from diferent sources on the page, but the pop up should not provoque this, right?

This is the error we are getting:

Thank you,

Maria João Portela