185

I recently started receiving the following console errors, without any code changes taking place.

I did not install any extensions recently.

Failed to load resource: net::ERR_FAILED chrome-extension://enhhojjnijigcajfphajepfemndkmdlo/cast_sender.js
Failed to load resource: net::ERR_FAILED chrome-extension://hfaagokkkhdbgiakmmlclaapfelnkoah/cast_sender.js
Failed to load resource: net::ERR_FAILED chrome-extension://enhhojjnijigcajfphajepfemndkmdlo/cast_sender.js
Failed to load resource: net::ERR_FAILED chrome-extension://fmfcbgogabcbclcofgocippekhfcmgfj/cast_sender.js
Failed to load resource: net::ERR_FAILED

I have several YouTube player embeds on the page that are triggering this error, but they are simple:

<iframe width="100%" height="100%" src="http://www.youtube.com/embed/OUR_YOUTUBE_ID?showinfo=0&amp;wmode=transparent" frameborder="0" allowfullscreen=""></iframe>

Has anybody else experienced this?

9
  • 1
    I'm hitting this too. Is it causing your JS not to run on the page?
    – davko
    Commented Sep 12, 2014 at 21:54
  • 1
    Infrequently, yes. I was able to replicate it a few times where it would break JS on the page, but most times I just see the console errors.
    – Alex
    Commented Sep 13, 2014 at 22:53
  • Is the embedded video still loading for you? It's not for me, which is bad. Commented Jan 12, 2015 at 17:34
  • 1
    amazingly, google adwords support is blocking sites that have this issue. highly frustrating. Commented Mar 27, 2015 at 17:08
  • 1
    Try disabling Adblocker extension for the site. Worked for me.
    – Robot Boy
    Commented Jul 7, 2016 at 8:21

6 Answers 6

143

Apparently YouTube constantly polls for Google Cast scripts even if the extension isn't installed.

From one commenter:

... it appears that Chrome attempts to get cast_sender.js on pages that have YouTube content. I'm guessing when Chrome sees media that it can stream it attempts to access the Chromecast extension. When the extension isn't present, the error is thrown.

Read more

The only solution I've come across is to install the Google Cast extension, whether you need it or not. You may then hide the toolbar button.

For more information and updates, see this SO question. Here's the official issue.

0
42

I'm going to add to the answer given before.

It's not a bug in your code or the browser's code. It's the JavaScript code inside the YouTube iframe polls for the extensions it could interoperate with in case they were installed (likely to determine if the extension is installed).

Look at the source of www-embed-player.js (loaded from s.ytimg.com, it's YouTube static files CDN). You'll find the following:

function Wj(a){return"chrome-extension://"+a+"/cast_sender.js"}
3
  • 5
    What do you suggest then? I don't want to install the Google Cast extension ! Something like overriding this function? Commented Feb 11, 2015 at 13:02
  • I can't find it in the source: s.ytimg.com/yts/jsbin/www-widgetapi-vfllgPgCl/www-widgetapi.js Commented Feb 11, 2015 at 13:10
  • 4
    First of all: overriding that function should not work, and you should not want to override functions of other people's sites. If you do succeed in doing that, you've succeeded in hacking Google Chrome, YouTube, or both. Also, it's their bug, not yours. Just file a bug report or something.Second, @sompylasar mentions that the code is in the source of a file called www-embed-player.js. Can you explain to us why you are looking at a different file but expect that function to be in there nevertheless?
    – toon81
    Commented Feb 12, 2015 at 13:09
22

To stop seeing those cast_sender.js errors, edit the youtube link in the iframe src and change embed to v

5
  • 3
    This worked for me, though I will add that you should only do this for Chrome, because in Firefox, this will cause the video to be loaded as Flash and will show a blocked plugin message. Commented Sep 28, 2015 at 16:39
  • Requiring a user to have flash installed in firefox, while annoying, is probably a better option than the Javascript on your webpage breaking. On my site, this issue seems to have a flow on affect preventing the required FontAwesome font from being downloaded. We will use this solution for now until we can re-work the way we embed videos on our site. Commented Oct 6, 2015 at 22:07
  • if you change the embed to v, then my iframe will not work. Any advice? i used this solution from this post stackoverflow.com/a/8521287/4812515 Commented Nov 24, 2015 at 23:57
  • 1
    Keep in mind .../v/... is depricated developers.google.com/youtube/… Commented Dec 16, 2015 at 12:34
  • Bad idea. If you use v instead of embed, youtube will use flash player instead of native html player.
    – CyberAleks
    Commented May 4, 2016 at 17:29
2

The error is try to fix a Youtube error.

The solution to avoid your Javascript-Console-Error complex is to accept that Youtube (and also other webpages) can have Javascript errors that you can't fix.

That is all.

0

A simple fix for this is to install the Google Cast extension. If you don't have a Chromecast, or don't want to use the extension, no problem; just don't use the extension.

0

In addition to what was already said - in order to avoid this error from interfering (stopping) other Javascript code on your page, you could try forcing the YouTube iframe to load last - after all other Javascript code is loaded.

Not the answer you're looking for? Browse other questions tagged or ask your own question.