react-youtube icon indicating copy to clipboard operation
react-youtube copied to clipboard

CORS error

Open timsofteng opened this issue 2 years ago • 15 comments

Hello. I've faced up with cors error during local development. Should it work if my domain is localhost?

timsofteng avatar Apr 25 '22 21:04 timsofteng

I'm also getting this error, I'm unsure when it was introduced since this is my first time using it.

Failed to execute 'postMessage' on 'DOMWindow': The target origin provided ('https://www.youtube.com') does not match the recipient window's origin ('http://localhost:3000').

It should be using //www,youtube.com without the https: to prevent this.

TomSmedley avatar Apr 28 '22 13:04 TomSmedley

This is something that the YouTube IFrame Player API does by itself and we don't have control over it.

ruisaraiva19 avatar Apr 28 '22 14:04 ruisaraiva19

Same error here, using React 18.1 and Next JS 12.1. I also tried setting origin as localhost:3000 and enablejsapi: 1 in opts , but no dice. Same error.

ahmedh01 avatar May 02 '22 18:05 ahmedh01

Also facing this, just updated to React 18 and nextjs 12.1. This started happening after the update. Did YouTube IFrame Player API change recently to enforce this to your knowledge @ruisaraiva19?

iamgoddog avatar May 10 '22 08:05 iamgoddog

Also facing this, just updated to React and nextjs 12.1. This started happening after the update. Did YouTube IFrame Player API change recently to enforce this to your knowledge @ruisaraiva19?

@iamgoddog Not that I'm aware of.

ruisaraiva19 avatar May 10 '22 09:05 ruisaraiva19

Same error

Same error, and I also solved by rollbacking to react 17 :(

sboh1214 avatar May 13 '22 14:05 sboh1214

env localhost react 17.02 Mozilla 100

When investigating in console, all request are 200 but error CROS ORIGIN

I hope it works in my peronal project online : / ...

c0ncentus avatar May 15 '22 12:05 c0ncentus

Got the same issue but a little bit different. The video player gets displayed for a short amount of time but then gets removed from the DOM.

visualcookie avatar May 17 '22 13:05 visualcookie

The video player gets displayed for a short amount of time but then hide this

Minhaj-T avatar May 23 '22 17:05 Minhaj-T

The video player gets displayed for a short amount of time but then hide this

@Minhaj-T which version of React are you using?

ruisaraiva19 avatar May 23 '22 22:05 ruisaraiva19

Same issue

empm0ney avatar Jun 03 '22 19:06 empm0ney

I'm also getting this error.

VictorHugoZB avatar Jun 08 '22 17:06 VictorHugoZB

For me it was working until today and suddenly this. Anyone got a solution??

lucianamerege avatar Nov 15 '22 01:11 lucianamerege

Got the same issue but a little bit different. The video player gets displayed for a short amount of time but then gets removed from the DOM.

I'm getting the same behaviour, using Nextjs 14. Did you find a solution?

timB73 avatar Jan 09 '24 21:01 timB73