{"id":15996693,"url":"https://github.com/mvsde/iframe-click-to-play","last_synced_at":"2025-10-21T05:30:20.060Z","repository":{"id":42905497,"uuid":"250491645","full_name":"mvsde/iframe-click-to-play","owner":"mvsde","description":"On-demand loading for iframes to conform with laws like GDPR.","archived":true,"fork":false,"pushed_at":"2024-10-14T07:49:21.000Z","size":241,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-04T04:49:43.723Z","etag":null,"topics":["click-to-play","gdpr","iframe"],"latest_commit_sha":null,"homepage":"https://iframe-click-to-play.fynn.be","language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mvsde.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2020-03-27T09:23:56.000Z","updated_at":"2024-10-14T07:49:43.000Z","dependencies_parsed_at":"2023-02-01T02:15:17.633Z","dependency_job_id":null,"html_url":"https://github.com/mvsde/iframe-click-to-play","commit_stats":{"total_commits":37,"total_committers":3,"mean_commits":"12.333333333333334","dds":0.5675675675675675,"last_synced_commit":"f1641ae15418937090febe03a59283952be97b9c"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mvsde%2Fiframe-click-to-play","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mvsde%2Fiframe-click-to-play/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mvsde%2Fiframe-click-to-play/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mvsde%2Fiframe-click-to-play/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mvsde","download_url":"https://codeload.github.com/mvsde/iframe-click-to-play/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":237436543,"owners_count":19309926,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["click-to-play","gdpr","iframe"],"created_at":"2024-10-08T08:00:34.851Z","updated_at":"2025-10-21T05:30:14.769Z","avatar_url":"https://github.com/mvsde.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# iframe Click-to-Play\n\nSome `\u003ciframe\u003e`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.\n\n[Demos →](https://iframe-click-to-play.fynn.be)\n\n## Installation\n\n```bash\nnpm install @mvsde/iframe-click-to-play\n```\n\n## Usage\n\n### Markup\n\nRename the `src` attribute of the `\u003ciframe\u003e` to `data-src` This makes sure no external content gets loaded without prior consent. A fallback element is required which may have arbitrary content. The trigger button can be part of the fallback element, but doesn’t need to be.\n\n#### Standalone `\u003ciframe\u003e`\n\n[Demo for the standalone variant →](https://iframe-click-to-play.fynn.be/standalone.html)\n\n```html\n\u003ciframe\n  class=\"iframe\"\n  data-src=\"https://www.youtube.com/embed/OrxmtDw4pVI\"\n  width=\"960\"\n  height=\"540\"\n\u003e\u003c/iframe\u003e\n\n\u003cdiv class=\"fallback\"\u003e\n  \u003ch2\u003eYouTube Video Embed\u003c/h2\u003e\n  \u003cp\u003eClick to load the embedded YouTube video.\u003c/p\u003e\n  \u003cbutton class=\"trigger\"\u003eLoad video\u003c/button\u003e\n\u003c/div\u003e\n```\n\n#### `\u003ciframe\u003e` within a container\n\n[Demo for the container variant →](https://iframe-click-to-play.fynn.be/container.html)\n\nThe `\u003ciframe\u003e` can be nested inside a container. The script automatically searches for the first descendant `\u003ciframe\u003e`.\n\n```html\n\u003cdiv class=\"iframe\"\u003e\n  \u003ciframe\n    data-src=\"https://www.youtube.com/embed/OrxmtDw4pVI\"\n    width=\"960\"\n    height=\"540\"\n  \u003e\u003c/iframe\u003e\n\u003c/div\u003e\n\n\u003cdiv class=\"fallback\"\u003e\n  \u003ch2\u003eYouTube Video Embed\u003c/h2\u003e\n  \u003cp\u003eClick to load the embedded YouTube video.\u003c/p\u003e\n  \u003cbutton class=\"trigger\"\u003eLoad video\u003c/button\u003e\n\u003c/div\u003e\n```\n\n### JavaScript\n\nSelect the `\u003ciframe\u003e` or the element containing it, the fallback element, and the trigger button. Create a new `IframeClickToPlay` instance.\n\n```js\nimport { IframeClickToPlay } from '@mvsde/iframe-click-to-play'\n\nconst iframe = document.querySelector('.iframe')\nconst fallback = document.querySelector('.fallback')\nconst trigger = document.querySelector('.trigger')\n\nnew IframeClickToPlay({ iframe, fallback, trigger }).init()\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmvsde%2Fiframe-click-to-play","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmvsde%2Fiframe-click-to-play","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmvsde%2Fiframe-click-to-play/lists"}