Skip to content

Remove the Plugin

unmount removes a plugin’s iframe. The element you mounted it on stays.

SportNinja.push(['unmount', '#sportninja']);
Argument Required What it is
target Only with several plugins The selector or element the plugin was mounted on. With one plugin on the page you can leave it out: SportNinja.push(['unmount']).

With several plugins on the page, unmount without a target removes nothing and logs a console warning.

  • Load embed.js and push init once, e.g. in your page template.
  • Mount when the container element is in the DOM (after render), and unmount before it’s removed, so a later mount on a new element works.
// React
useEffect(() => {
const element = ref.current;
window.SportNinja = window.SportNinja || [];
window.SportNinja.push(['mount', element, options]);
return () => window.SportNinja.push(['unmount', element]);
}, []);
  • Leave syncUrl on only if your router doesn’t use the hash; the plugin keeps its page in #sn=….