cast_sender.js error: Failed to load resource: net::ERR_FAILED in Chrome

JavascriptYoutube

Javascript Problem Overview


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?

Javascript Solutions


Solution 1 - Javascript

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.

Solution 2 - Javascript

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"}

Solution 3 - Javascript

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

Solution 4 - Javascript

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.

Solution 5 - Javascript

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

[1]: https://chrome.google.com/webstore/detail/google-cast/boadgeojelhgndaghljhdicfkmllpafd?utm_source=yourmom "Google Cast"

Solution 6 - Javascript

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.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionAlexView Question on Stackoverflow
Solution 1 - JavascriptisherwoodView Answer on Stackoverflow
Solution 2 - JavascriptsompylasarView Answer on Stackoverflow
Solution 3 - JavascriptVadiraj PurohitView Answer on Stackoverflow
Solution 4 - Javascriptuser5775253View Answer on Stackoverflow
Solution 5 - JavascriptMark KimitchView Answer on Stackoverflow
Solution 6 - JavascriptbderetaView Answer on Stackoverflow