r/programming • • Oct 27 '26

Iframes should have an api

https://blog.danielbrain.ai/iframes-should-have-an-api

There's been a big resurgence lately in automating and interacting with sites programmatically. I've been arguing for a few years that every front-end should be embeddable as a component and have its own client side interface/api. This article is designed to show one way to do that!

0 Upvotes

7 comments sorted by

2

u/Primary_Ads Oct 27 '26

honestly much more compelling than I expected something titled "iframes should have an api" to be, the example provided really makes it clear how useful this could be. it seems more useful than the already very useful zoid, although I dont really work on products that need either.

1

u/Electronic-Gap-1538 8d ago

zoid was great for decoupling but the maintenance overhead of managing those separate builds killed us in early stage startups. explicit apis cut down the dev friction significantly.

2

u/wwb_99 Oct 27 '26

It has been a long time since I've done real javascript browser skuduggery, but don't you have access to the DOM for said iframe from within the greater frame?

1

u/michael-2948 19d ago

Only if it's same-origin. Cross-origin is where the DOM stops being a shared playground and starts needing an actual API.

1

u/WhitepaprCloudInvite Oct 29 '26

Razor component much.

-1

u/bastardpants Oct 27 '26

At the end of the day, a message your page sends to code you've already loaded from my site is one less thing I can track. I need to read the details tomorrow; it's late and my eyes glaze over after reading too much Claude output.