Jordan Simon
Jordan Simon

Reputation: 289

Why does chromecast api fail to load in chrome extension?

I am trying to open build a chrome extension that as a controller for chromecast app. The app fails to load Chromecast API:

Failed to load resource: net::ERR_FAILED chrome-extension://www.gstatic.com/cast/sdk/libs/receiver/2.0.0/cast_receiver.js

In my index.html header:

<script src="//www.gstatic.com/cast/sdk/libs/receiver/2.0.0/cast_receiver.js"></script>

I tried adding the gstatic in the manifest:

"permissions": [
        "www.gstatic.com/"
    ]

So no success. What am I doing wrong to include the API into the chrome extention?

Upvotes: 0

Views: 992

Answers (1)

abraham
abraham

Reputation: 47833

Chrome extensions run on the scheme chrome-extension:// not https://. Since you have a scheme agnostic URL in <script/> Chrome tries to load the resource from the extension files. Use <script src="https://www.gstatic.com/.."></script>.

You will also have to change your permissions to include the https://.

Upvotes: 1

Related Questions