Skip to content
Videokr Start free

Embed codes: iframe, script loader and parameters

Videokr gives you two embed codes for the same video. An iframe pointing at /e/VIDEO_ID works anywhere HTML is allowed, and a one-line script loader (embed.js with data-video) inserts a responsive iframe for you and reports its own height for playlists. Both accept autoplay, muted, start and token parameters.

Iframe embed

<iframe src="https://videokr.com/e/vid_abc123" title="Product tour"
        style="width:100%;aspect-ratio:16/9;border:0"
        allow="autoplay; fullscreen; picture-in-picture; encrypted-media"
        loading="lazy"></iframe>

Use the iframe when the host page restricts scripts (many CMS and email-builder contexts do). Keep aspect-ratio on the iframe rather than a fixed height so it stays responsive, and keep loading="lazy" so an embed below the fold costs the page nothing until it is scrolled into view.

Script loader

<script src="https://videokr.com/embed.js" data-video="vid_abc123" async></script>

The loader replaces itself with a correctly-shaped, responsive box, sets the iframe allow list and loading="lazy" for you, and — for a playlist — listens for the player's own height message so the queue is never clipped.

Attributes:

AttributePurpose
data-videoVideo id or slug.
data-playlistPlaylist id or slug (instead of data-video).
data-targetCSS selector to mount into, instead of in place.
data-widthAny CSS width; defaults to 100%.
data-ratio16/9 for a video, 16/11 default for a playlist.
data-autoplayStart playback when allowed by the browser.
data-mutedRequired alongside autoplay in most browsers.
data-startStart at N seconds.
data-tokenAccess token for a password-protected video.

URL parameters

The same options work on the iframe URL: /e/vid_abc123?autoplay=1&muted=1&start=30. A playlist embed uses /ep/PLAYLIST.

Autoplay only starts without a click when the video is muted — that is a browser rule, not a Videokr one. An autoplaying muted loop with a visible unmute control converts better than a forced-sound autoplay that the browser blocks anyway.

Multiple embeds on one page

Both forms are safe to repeat. Each embed is a separate player in its own iframe, so styles cannot leak between your page and the player either way.

Every video also has a shareable public page at /v/slug with ?t=90 deep linking into a moment, and a Markdown twin at /v/slug.md for assistants. See SEO video pages.

Access-controlled embeds

A domain-locked video only plays on the hostnames you list — wildcards allowed — and refuses anywhere else, so a copied embed code is worthless on someone else's site. A password-protected video needs a token, which the public page issues after the password is entered.

Frequently asked questions

Which embed should I use?

The script loader, unless your CMS strips scripts — it handles sizing and lazy loading for you. Use the plain iframe where scripts are not allowed.

Does the embed work outside WordPress?

Yes. Both embeds are plain HTML and work on any site or framework. The WordPress plugin is a convenience, not a requirement.