zouhir / preact-habitat

Zero configuration Preact widgets renderer in any host DOM
MIT License
518 stars 43 forks source link

Can I render widget into iframe? #40

Closed yuri-dzabaev closed 5 years ago

ascorbic commented 5 years ago

No, this won't work because the iframe isn't part of the parent page's DOM.

617dev commented 4 years ago

@ascorbic so i get what you're saying, and i have experience building and supporting both types of embedded publisher widgets at scale. I'm curious if you or anyone you know has experience using preact-habitat to distribute a third party widget to a network of random publisher sites. By random I mean there is no control of what the parent page that the widget will be embedded on. Without an iFrame, there is obviously a lot of trust the publishers have to have, but aside from that the biggest pitfalls for us of running a widget in a DOM we don't control was CSS seepage (even though all our CSS was scoped, if the publisher site styled block elements, or had some resets, it could break the UI) and also JS collision with things like Babel-polyfill for instance, but could be anything global really... We found an iFrame and pre-rendering with gatsby to be a great solution, but i'm working on a much smaller and simpler type of widget with almost no logic or interactivity, but still needs to render a consistent UI and i was wondering if you or anyone in this preact widget community has any tips? Thanks in advance!