Skip to content
micro-frontend.dev 2.0

Iframes and micro-frontends

Author: Natalia Venditto

Date First Published: Wed Jan 04 2023

Are iframes outdated?

Iframes are obviously not a modern piece of technology: they have been around for a very long time, and they pose some serious challenges, like responsive behavior, since they were not designed with responsive or cross device/screen support in mind.

It’s because Iframes have been around for a while, precisely, that they have become an industry proven solution that does suit some use-cases in micro-frontends composition, particularly when there is a priority requirement for encapsulation, including a full out-of-the-box sandbox capability.

Communication between iframes and the shell

Even when iframes work as a sandbox to our code, helping us encapsulate the micro-parts, modern web patform APIs like postMessage, that I discuss here in more detail can be used to communicate between elements loaded in iframes, and the shell or host app.

The important thing to remember, is that they still may be a valid option, and that they can be used in combination with other technologies, like web components, to compose a micro-frontend architecture.

We will need to have a very efficient strategy for commonalities or shared dependencies assets.