← Back to blogEmbedded simulations

Embed an Interactive Circuit in Your Lesson or Blog

A production-ready guide to DigiSim iframe embeds for Canvas, Moodle, WordPress, Notion, and Ghost—with responsive HTML, accessibility, privacy, security, and fallback guidance.

DennyDenny
8 min read
Chalkboard feature illustration for “Embed an Interactive Circuit in Your Lesson or Blog”

TL;DR: A published DigiSim template can be loaded from https://digisim.io/circuits/embed/template/<slug>. Use a titled, lazy-loaded iframe inside a responsive wrapper; add an adjacent full-page link and equivalent explanation; then test the real LMS for iframe filtering, Content Security Policy, cookies, keyboard access, and mobile layout. A simulator supporting embeds does not guarantee that every host permits them.

An interactive circuit can keep explanation and experimentation on the same page. It can also fail silently when an editor strips the iframe, a security policy blocks the source, or a learner cannot operate the embedded canvas. A professional embed therefore needs more than copied HTML.

This guide covers the working DigiSim URL pattern, a production-ready snippet, platform-specific insertion points, and the accessibility, privacy, security, and performance checks required before publishing.

1. Build the Embed URL

For a published Logic template, use:

https://digisim.io/circuits/embed/template/<template-slug>

The slug is the final segment of the public template page. For example:

  • Public page: https://digisim.io/template/basic-switch-and-light-demo
  • Embed: https://digisim.io/circuits/embed/template/basic-switch-and-light-demo

DigiSim’s current embed surface accepts these controls:

ParameterExamplePurpose
themedark or lightSelect the embed color theme
interacttrue or falseEnable or suppress canvas interaction
toolbartrue or falseShow or hide embed controls
speedslow or normalSelect the supported animation speed
zoomfitRequest an initial fitted template view

A lesson-oriented URL might be:

https://digisim.io/circuits/embed/template/basic-switch-and-light-demo?theme=light&toolbar=true&interact=true&zoom=fit

Relay embeds use a related route:

https://digisim.io/circuits/embed/relay/<slug>?theme=dark&interact=true&sound=on

Relay embeds can also accept controls such as speed, toolbar, zoom, panel, and sound. Use only published slugs and test the final URL directly before placing it in another system.

2. Use a Production-Ready Iframe

This example reserves a responsive 16:9 region, names the iframe, defers loading, and provides a fallback link:

<figure class="circuit-example">
  <div class="circuit-example__frame">
    <iframe
      src="https://digisim.io/circuits/embed/template/basic-switch-and-light-demo?theme=light&amp;toolbar=true&amp;interact=true&amp;zoom=fit"
      title="Interactive switch-and-light logic circuit"
      loading="lazy"
      referrerpolicy="strict-origin-when-cross-origin"
      allow="autoplay">
    </iframe>
  </div>
  <figcaption>
    Toggle the input and compare the output with the expected logic state.
    <a href="https://digisim.io/template/basic-switch-and-light-demo">
      Open the circuit on its full page
    </a>.
  </figcaption>
</figure>
.circuit-example {
  margin: 1.5rem 0;
}

.circuit-example__frame {
  aspect-ratio: 16 / 9;
  min-height: 22rem;
}

.circuit-example__frame iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 1px solid #d8d8d8;
  border-radius: 0.5rem;
}

@media (max-width: 40rem) {
  .circuit-example__frame {
    aspect-ratio: auto;
    height: 30rem;
    min-height: 0;
  }
}

Choose height from the circuit, not from a universal rule. A compact gate may need less space than an ALU or teaching CPU. Test at 200% browser zoom and at the narrowest supported viewport; nested scrollbars are a warning that the frame is too small.

Why these attributes matter

  • title gives the iframe an accessible name. It should identify the circuit or activity, not say merely “interactive content.”
  • loading="lazy" lets the browser defer an off-screen iframe.
  • referrerpolicy limits the cross-origin referrer to the origin under normal HTTPS navigation.
  • allow="autoplay" permits supported audio/animation behavior, still subject to browser gesture and autoplay rules.
  • A normal link lets a learner escape a blocked, cramped, or unsupported embed.

Do not add a restrictive sandbox attribute by guesswork. It can disable scripts, storage, downloads, forms, or other behavior the simulator needs. If an institution requires sandboxing, its security team should define and test the minimum permissions.

3. Insert It in the Publishing Platform

Editor labels and security policies change. The reliable pattern is to locate an HTML or embed surface, publish a private test, and inspect the page as a learner rather than trusting the authoring preview.

Canvas

Use the Rich Content Editor’s HTML/source view where your institution permits iframe markup. If the iframe disappears after saving or shows a browser refusal, the course author may not have authority to fix it. Ask the Canvas administrator to review HTML sanitization and the allowed frame source.

Test in Student View and in the Canvas mobile environment used by the class. An author preview does not establish that students receive the same permissions.

Moodle

Insert the iframe through the editor’s HTML/source view in a Page, Label, or other administrator-approved content area. Moodle intentionally strips iframe markup from some user-contributed activities, and site configuration can restrict external content.

If the saved page contains only a link—or nothing—the issue is likely filtering or role capability, not the DigiSim URL. Work with the Moodle administrator instead of repeatedly changing the tag.

WordPress

Use a Custom HTML block. WordPress documentation notes that users without the unfiltered_html capability can have disallowed tags, including iframe, removed during saving. Security plugins, a host policy, or Content Security Policy can add further restrictions.

Preview the published page while signed out. If the editor preview fails but the public page works, inspect browser developer tools and site security headers before changing the embed.

Notion

Create an Embed block and paste the HTTPS embed URL—not the <iframe> tag. Notion’s help documentation notes that some sites cannot be embedded and that its embed service and the embedded application may receive viewer IP addresses as needed to display the content.

Resize the block, open the page in the desktop and mobile clients used by learners, and retain a full-page circuit link. External embeds that require login may not work consistently in Notion apps; public template embeds avoid making login part of the viewing task.

Ghost

Add an HTML card and paste the iframe markup. Ghost documents HTML cards as the route for custom external content. Verify the published theme at desktop and mobile widths, because theme CSS—not the card alone—controls the final responsive frame.

A host that does not allow arbitrary iframes

Use a static circuit image, a concise activity description, and a normal link to the public template page. That is not a failed implementation; it is a robust fallback for platforms whose security model deliberately excludes third-party applications.

4. Configure the Host’s Security Policy

On a website you control, Content Security Policy may need a frame-src entry:

Content-Security-Policy: frame-src 'self' https://digisim.io;

Do not copy this line over an existing policy. Merge the origin into the site’s reviewed policy, preserving its other directives. Depending on the implementation, child-src or a default-src fallback may also affect frames.

If the iframe still fails, inspect the browser console for:

  • a host-side frame-src or default-src violation;
  • an upstream frame-ancestor restriction;
  • blocked mixed content;
  • authentication or third-party-cookie problems;
  • an extension or network filter; or
  • HTML sanitization that removed the tag before the browser received it.

The error message determines whether the fix belongs to the author, LMS administrator, website operator, or network team.

5. Treat Accessibility as More Than an Iframe Title

A descriptive title is necessary but does not make the embedded application accessible by itself.

For every circuit activity:

  1. State the objective outside the frame. Tell the learner what to change, observe, and explain.
  2. Provide an equivalent description. Include the expected truth table, state sequence, or written result so the concept is not available only through animation.
  3. Provide a full-page link. A larger viewport can help with zoom, touch, and keyboard use.
  4. Test keyboard focus. Confirm that a learner can enter the frame, reach required controls, and return to the surrounding page.
  5. Do not rely only on color or motion. Name the signal and state in adjacent text.
  6. Test zoom and reflow. Check 200% zoom, narrow screens, and enlarged OS text.
  7. Offer an alternative activity when needed. A static schematic plus truth-table exercise can assess the same concept for a learner who cannot operate the canvas.

Use the assistive technologies represented in the class. Automated scans cannot evaluate the entire cross-origin interaction.

6. Document Privacy and Data Flow

An iframe is a third-party request. When the page loads it, the viewer’s browser connects to digisim.io; normal web request data such as IP address, browser information, and referrer information subject to the chosen policy may be processed. Existing DigiSim cookies may also be sent according to browser cookie rules.

Before publishing:

  • review the DigiSim privacy policy and current terms;
  • disclose the embedded third party in the host’s privacy or course notice;
  • determine whether local law or institutional policy requires consent before loading it;
  • avoid placing personal or assessment data in query parameters;
  • use public templates for anonymous viewing; and
  • provide a non-embedded link or equivalent activity when third-party content is declined.

Private browsing is a troubleshooting technique, not a compliance strategy.

7. Protect Page Performance

Each live circuit loads an application. On a long lesson, several simultaneous iframes can compete for network, memory, and CPU.

Use these controls:

  • lazy-load below-the-fold frames;
  • reserve frame dimensions to avoid layout shift;
  • embed only the circuits students need at that point;
  • consider a click-to-load preview for a page with many simulations;
  • pause or reduce motion where the embed supports it;
  • test on a representative low-power device and constrained network; and
  • keep screenshots optimized, but never use a screenshot as the only fallback explanation.

Measure the published page with real embeds enabled. A development preview with cached assets can hide the learner’s first-load cost.

8. Validate the Learning Activity

Embedding is a delivery method, not a lesson by itself. A useful circuit block includes:

  • a specific prediction before interaction;
  • a small set of actions;
  • an observable result;
  • a question that requires explanation; and
  • a fallback result against which the learner can check reasoning.

For a binary counter, for example:

Predict the state after five rising edges. Run exactly five edges, compare the four outputs with your prediction, and explain which flip-flops changed on the fifth edge.

That prompt turns animation into evidence. “Play with the circuit” does not.

Worked Example: Four-Bit Counter

<figure class="circuit-example">
  <div class="circuit-example__frame">
    <iframe
      src="https://digisim.io/circuits/embed/template/template-4-bit-binary-counter?theme=light&amp;toolbar=true&amp;interact=true&amp;zoom=fit"
      title="Interactive four-bit binary counter"
      loading="lazy"
      referrerpolicy="strict-origin-when-cross-origin"
      allow="autoplay">
    </iframe>
  </div>
  <figcaption>
    Predict the next state before advancing the clock.
    <a href="https://digisim.io/template/template-4-bit-binary-counter">
      Open the four-bit counter on its full page
    </a>.
  </figcaption>
</figure>

After publishing, complete this checklist:

  • the iframe survives saving;
  • the circuit loads for a signed-out learner;
  • required controls work;
  • keyboard focus can enter and leave;
  • the layout works at narrow width and 200% zoom;
  • the full-page fallback link works;
  • the activity has an equivalent text explanation;
  • the privacy notice covers the third-party request; and
  • the page remains responsive with every embed loaded.

Next Step

Browse the template catalog, choose one circuit tied to a concrete learning objective, and pilot it in a private lesson. If you want a sequenced explanation around the circuit rather than a standalone interaction, use the published guide to SimCast lessons.

Platform References

If the DigiSim URL or a documented parameter changes, contact us. We will verify the behavior and record substantive corrections through the article’s update date.

Apply the concept in a simulator model.