New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@mvsde/iframe-click-to-play

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mvsde/iframe-click-to-play

Some ``s might save cookies or do other kinds of tracking. This isn't allowed under GDPR law without prior consent from the user. A "click-to-play" solution helps with this situation.

  • 0.1.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
5
increased by66.67%
Maintainers
1
Weekly downloads
 
Created
Source

<iframe> click-to-play

Some <iframe>s might save cookies or do other kinds of tracking. This isn't allowed under GDPR law without prior consent from the user. A "click-to-play" solution helps with this situation.

Demo

Installation

npm install @mvsde/iframe-click-to-play

Usage

Markup

The <iframe> has to have a data-src attribute pointing to the desired source. A fallback element is required which may have arbitrary content.

<iframe
  class="iframe"
  data-src="https://www.youtube.com/embed/OrxmtDw4pVI"
  width="960"
  height="540"
></iframe>

<div class="fallback">
  <h2>YouTube Video Embed</h2>
  <p>Click to load the embedded YouTube video.</p>
  <button>Load video</button>
</div>

JavaScript

Select the <iframe> and fallback elements and create a new IframeClickToPlay instance.

import IframeClickToPlay from '@mvsde/iframe-click-to-play'

const iframe = document.querySelector('.iframe')
const fallback = document.querySelector('.fallback')

new IframeClickToPlay(iframe, fallback).init()

FAQs

Package last updated on 27 Mar 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc