Industry Insights

New Script Embeds: The Future of Liveblogging

Understand the trade-offs between script tags and iframes for embedding live content. Our new script embed for Timepath Liveblog offers a safer, more powerful solution for modern publishers.

Rohan Agarwal · Security Hacker
4 min read
We've shipped a new script embed for Timepath Liveblog that's indexable, responsive, and customizable. Learn why a script tag is a better choice for your live content than an iframe.

New Script Embeds: The Future of Liveblogging

We just shipped a new way to embed Timepath Liveblog on your site: a lightweight script tag you drop into your page, no iframe required. This lets live updates behave like native page content (indexable, responsive, customizable) while still being safe and controllable by you. Try it: timepath.co/test-liveblog

Why move from an iframe to a script?

Many people think “iframes = safer” and that’s true in the narrow sense that iframes give a stronger browsing-context isolation by default. But that isolation also prevents important capabilities you usually want from a modern liveblog: content indexing, seamless styling, richer interactions, and advanced ad formats. MDN Web Docs

Script embeds give you practical benefits:

  • Indexable content & SEO: content added by script can be crawled and ranked more easily than content trapped inside an iframe. Bits and Pieces

  • Full styling + responsive design: embeds inherit the host page’s CSS and layout; they feel native. Bits and Pieces

  • Better analytics & integrations: direct DOM access means easier event tracking and integration with your analytics stacks. Bits and Pieces

  • Rich ad support: certain ad formats (expanding creatives, overlays, programmatic hooks) are much easier to implement from an in-page script than inside an isolated iframe. (That’s one of the reasons we now support ads in Liveblog.) Stack OverflowReddit

Bottom line: iframes are helpful when you need hard isolation. For publishers who want a first-class, brandable live experience — and ad monetization — a script embed is the better tradeoff.

How we keep script embeds safe

We’ve built safety controls into the embed and into how you should serve it (short checklist below). We also apply a CORS policy on our script endpoint so you control who can load the script from your domain and to prevent cross-origin surprises. (CORS is an HTTP-header mechanism browsers use to allow or block cross-origin resource loads.) MDN Web Docs

Ready-to-drop embed (example)

<!-- Timepath Liveblog script (example) -->
<script src="https://liveblog-script.timepath.co/timepath-liveblog.umd.js"
crossorigin="anonymous"
async
integrity="sha384-<your-sri-here>"></script>
<div id="timepath-liveblog" data-liveblog-id="ABC123"></div>
<script>
TimepathLiveblog.render('#timepath-liveblog', { theme: 'compact' });
</script>

Notes:

  • crossorigin="anonymous" + matching Access-Control-Allow-Origin on the script host ensures the browser treats the request correctly for SRI and other cross-origin checks. W3SchoolsStack Overflow

  • We recommend async so the script won’t block initial paint.

Quick server-side examples (if you host resources)

Nginx:

add_header 'Access-Control-Allow-Origin' 'https://your-site.example';
add_header 'Access-Control-Allow-Methods' 'GET, OPTIONS';
add_header 'Access-Control-Allow-Headers' 'Content-Type';

Apache:

Header set Access-Control-Allow-Origin "https://your-site.example"

Want the old iframe fallback?

We provide an iframe fallback for maximum isolation but note the tradeoffs: the iframe approach preserves isolation yet loses SEO, styling and some ad features. Use it if you need strong sandboxing; use the script embed if you want a richer, monetizable live experience. MDN Web Docs


Security deep-dive: How we secure script embeds (short technical explainer)

Embedding live functionality via script raises sensible security questions. Here’s how we think about the risks and the controls we (and you) can use.

Main threat categories

  • Supply-chain / script tampering: an attacker modifies the served script (mitigated by SRI + HTTPS).

  • Cross-site data leakage: script running in host page could access page variables or cookies if misconfigured.

  • XSS & content injection: content injected into the DOM must be sanitized.

  • Unauthorized embedding: someone embeds your liveblog on a domain you don’t control.

Controls we use (and recommend)

  1. HTTPS + Subresource Integrity (SRI)
    Always serve the script over HTTPS and use SRI so browsers verify the script hash before executing it. This prevents tampered payloads from running. MDN Web DocsCSS-Tricks

  2. Tight CORS policy on the script endpoint
    Only allow approved origins to request the script (Access-Control-Allow-Origin set to your domain(s)). This reduces unauthorized embedding and ensures proper cross-origin handling. MDN Web Docs

  3. Content Security Policy (CSP)
    Use Content-Security-Policy headers (script-src, connect-src, frame-ancestors, etc.) on your site to limit what the page and embedded scripts can do and where they can talk to. For example:

    Content-Security-Policy:
    default-src 'self';
    script-src 'self' https://cdn.timepath.co 'sha256-<your-inline-hash>';
    connect-src 'self' https://api.timepath.co;
    frame-ancestors 'none';

    CSP dramatically reduces XSS risk and controls network endpoints the script can contact. MDN Web Docs

  4. Least-privilege embed API
    Our embed API exposes only the minimal public methods needed to render the liveblog; sensitive operations never run in the embed. Keep host-page integration to a minimum surface area.

  5. Ad isolation inside the embed
    For ad units we isolate third-party ad creatives inside nested iframes (sandboxed) where appropriate combining the best of both worlds: native layout + carefully sandboxed ad creatives.

  6. postMessage with origin checks
    If the host page and embed must exchange messages, we use window.postMessage and strictly verify the event.origin on both sides.

  7. Server-side validation & logging
    Any data posted to our API from the embed is validated server-side and logged for anomaly detection.

  8. Pen tests & SAST/DAST
    Regular security testing of the embed and its delivery pipeline is part of our release process.

All industry insights
Industry insights context layer
Industry Insights

The Context Layer in Journalism: Why Newsrooms Need More Than Just Content

In an era of information overload, the problem isn't a lack of news — it’s a lack of structure. This article explores why audiences, particularly those under 35, are increasingly avoiding the news due to its fragmented nature. We introduce the concept of the "Context Layer," a new category of newsroom infrastructure that sits between the CMS and Analytics. By using tools like interactive timelines, structured collections, and agile liveblogs, publishers can reduce cognitive load, connect stories over time, and bridge the generational gap in news consumption.

Timepath · Industry Insights
With misinformation on the rise, we're developing a pilot with Dutch journalists and the Cardano community to build a new system for verifying the authenticity of news. Learn how we're working to restore public trust in media.
Industry Insights

A new way to verify the news: How we're partnering with Journalists to fight misinformation

With misinformation on the rise, we're developing a pilot with Dutch journalists and the Cardano community to build a new system for verifying the authenticity of news. Learn how we're working to restore public trust in media.

Frido van Driem · Founder
Sleeping Student
Industry Insights

From Scrolling to Interaction: How Timepath’s Interactive Tools Boost Engagement in News Articles

In today’s fast-paced digital world, capturing a reader’s attention is harder than ever. People skim headlines, scroll quickly, and often leave before reaching the end of a story. The challenge for publishers is not just to get clicks, but to keep readers engaged — and turn passive consumption into active participation.

Frido van Driem · Founder

Build one like it

Everything written about here was made in the Timepath editor and embedded into the newsroom's own site. A free account makes and publishes the real thing.

Subscribe for updates

Product news, newsroom stories and new formats — occasionally, never spam.