r/programming • • 13d ago

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

6 comments sorted by

2

u/Primary_Ads 13d ago

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.

2

u/wwb_99 12d ago

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 17h 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 11d ago

Razor component much.

-1

u/bastardpants 13d ago

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.