So it’s best to limit where your extension will be active by explicitly setting permissions in the manifest. When users see ‘This extension can see and modify data on all pages’, they get nervous. There are plenty more elements that can be used in an extension, but this list covers the core that will get most of your extension built and most other parts are for specific tasks. This is what we’ll use for our extension. All the JS files in the list are loaded, so you can use libraries just by including it. Files are run once for each page that matches the manifest.
Google cast chrome extension side load code#
The only part that can access and modify the DOM but not code loaded by the website. These pages cannot communicate with the website resources/DOM, it needs to message the content script to do that. Clicking on the icon will show a UI tab which is an HTML page that can reference javascript.
If it’s not referenced in there, it won’t be used. The manifest is what binds it all together. " js": Īll the files for your extension should be in the same directory, which will be zipped up when you upload it. You also set metadata like icons and descriptions which will be used when you upload your extension to the Chrome app store (this is the only sensible way to distribute it outside of a corporate environment).
Google cast chrome extension side load how to#
It declares what files are a part of your project and tells Chrome how to use them. Setting upĮvery extension needs a manifest file. The whole lot is in javascript, which gives you easy access to the DOM and is essentially like writing client side code except you have a few extra APIs for access to the browser and code is scoped meaning you can’t communicate with code that the page loads. It’s a good place to start since it gets you used to the environment without getting too complicated. This is a method used by extensions like the various adblockers to identify and remove adverts. In this post I want to show how you can write a simple extension that modifies the content of the page once it’s loaded. The docs are fairly good however, so take a look at them when building your tool. While the extension is open, you can cast or anyone you've shared the extension with can request to cast or can present if you permitted casting without a request.Ĭasts appear in your Cast for Education extension on the teacher device connected to the projector.Writing a Chrome extension can be a bit tricky initially, due to it’s API and the way you have to structure your code. To start accepting casts from your students, open the Cast for Education extension on your computer. Note: Students that aren’t on the list won't see the extension in their Chrome toolbar.
You need to approve or deny each request.
Can request-Students can request to cast.Can present-Students can cast to your screen anytime you have the extension open.