The Supercast Javascript library can be used to enhance your website with Supercast functionality. It's comprised of custom elements that can be placed directly on any of your webpages to provide Supercast functionality with a line of code, or by utilizing Javascript methods that allow you to directly interact with your subscriber's Supercast accounts directly in their browser sessions.

Including the Supercast Javascript Library

You can include the Javascript Library on any page with the following code snippet:

<script src="https://(your subdomain).supercast.com/js/embed.js"></script>

Replace (your subdomain) with your Supercast subdomain.

This will always retrieve the latest version of the library. Any changes we make are always backwards-compatible. We recommend including the library on all of your pages in the HEAD section.

📘

Loading embed.js from your subdomain

Previous versions of Supercast embeds were loaded from "https://supercast.tech/js/embed.js". By loading from your own Supercast domain, you can omit specifying your subdomain in elements and Javascript functions. The old method of not using a subdomain and specifying it in all functions and elements is still supported, but not recommended.

Custom Elements

Custom elements provide an easy way to bring Supercast functionality to your webpage. By including a single HTML element, you can allow your users to purchase subscriptions, connect their players, or gate content behind a subscription.

Javascript functions

The Supercast Javascript library additionally contains some Javascript functions that can be used to interact with Supercast.

Events

You can listen to these events to execute Javascript code in response to Supercast events