Skip to content

Embedding LinkedIn on a websiteBy the LinkedInEmbed team · Updated

Should I use the script or the iframe embed code for my LinkedIn widget?

Short answer

Use the script snippet whenever your website builder allows JavaScript: it loads the widget and resizes it to fit its content automatically. Use the iframe snippet only where scripts are stripped or blocked. The iframe needs no JavaScript but has a fixed height, 640 pixels by default, so you adjust the height yourself.

Script vs iframe

Script snippetIframe snippet
What you pasteA <div> placeholder and one <script> tagOne <iframe> tag
HeightResizes to fit the content automaticallyFixed; 640px by default, edit to fit
Needs JavaScriptYesNo
Several widgets on a pageOne script loads them allOne iframe per widget
Best forWordPress, Webflow, Shopify, plain HTML, ReactBuilders or plans that strip scripts

What each snippet looks like

Script: <div class="linkedembed-widget" data-widget-id="…"></div> followed by <script src="https://www.linkedinembed.com/embed.js" async></script>. Both parts are required. Copy the exact code with your widget ID from the Integration tab, and don't edit the ID: it's how the code finds your widget.

Iframe: a single <iframe> tag that points at your widget and includes loading="lazy" and a height in its style. Change the height value until the whole widget shows without empty space, and check it on mobile, where content is often taller.

Which one for your builder

  • WordPress: script in a Custom HTML block. Some WordPress.com plans strip scripts; use the iframe there.
  • Squarespace: scripts in Code blocks need a plan with custom code support; otherwise use the iframe.
  • Wix and Framer: embeds sit in a fixed-size box, so set the element's height either way.
  • Webflow: script in a Code Embed element; it runs on the published site, not in the Designer.
  • React / Next.js: script, plus window.LinkedEmbed?.mount() after client-side navigation.

If your site sends a Content Security Policy, allow the LinkedInEmbed domain in script-src (for the script) and frame-src (for the widget frame). More fixes in LinkedIn feed not showing.

Switching between them

Both snippets show the same widget, so you can switch at any time without touching your design settings. Copy the other snippet from the Integration tab, replace the old code and republish your page. You only need one of them per placement.

Moving from the iframe to the script? Remove any fixed height or wrapper you added, since the script handles sizing. Moving to the iframe? Set a height that fits your longest content on mobile, because the iframe won't grow by itself. Both versions load the widget lazily, so neither holds up the rest of your page.

Show your LinkedIn on your website

Paste a LinkedIn URL, match your brand and embed with one snippet. Free plan, no credit card.

Create a free widget

All questions about embedding LinkedIn

Put your LinkedIn on your website today

Create your first widget in about two minutes. Free plan, no credit card required.