Omit scripts from HTML

Number of publishers supplement their embed codes with their hosted JavaScript. Which may spell a trouble if your app's engine does not natively run such 3rd party scripts (see React, for example).

Iframely also adds our embed.js JavaScript to HTML codes of our iFrames when required for an individual embed.

No worries: when there are several repeated embed.js script tags on your page, a browser will still load it only once due to cache-control HTTP headers, so there's no drag on user's bandwidth or your site's performance.

Iframely can wrap all such script-based 3rd party embed codes into our iFrame and give you our single embed.js to add to your system.

Omit 3rd-party scripts

You can add it as an option in your API settings, or simply send it as &omit_script=1 query-string parameter with individual API calls.

In that case, Iframely will wrap e.g. Twitter, Instagram, Facebook etc into our <iframe ... > code. For providers that already give an iFrame, Iframely will simply ignore that parameter and will follow your other preferences.

Our embed.js is also omitted

When you request &omit_script=1, our own script will not be included with HTML code at all and you need to add it to your site yourself. See below.

Besides 3rd-party scripts, our embed.js also renders Iframely cards, does lazy-loading when requested and other things.

As such, our script may decide to use Web Component imports for the Internet browsers that support it well (Chrome and Opera), to make bulk-inserts of embeds even faster there (but you won't need to deal with 3rd party scripts).

To disable Web Components, uncheck it in your API Settings, if that causes issues with your site's runtime.

Load embed.js script when required

As your pages may or may not have our embeds on it, we suggest the following asynchronous script that loads embed.js only when required:

If you use custom CDN option - please, source embed.js script from your own domain name.

If you need even better control, you may also use other events and methods our Embed.js script provides. Take a read.

Previous article: Omit CSS
Next article: Allow origins