My current project involves integrating a custom widget into users' websites for my application. I am considering using an iframe as it seems to be the most efficient option for several reasons:
- Utilizing the custom framework of the application will save me time by providing pre-built code and features that are essential for the widget, such as cross-browser event handlers and prototyped objects.
- Avoiding CSS conflicts is easier with an iframe, eliminating the need for inline css for every dom element created.
- Cross-domain requests are not an issue due to prior development work utilizing jsonp for communication.
The plan currently entails creating a javascript snippet that acts as a button to load a transparent full-screen iframe on top of the window. This setup allows me complete control over the view and enables seamless integration of the widget within the parent application. Users can interact with the widget just like any other part of the website, with the ability to dismiss it by clicking outside the widget's boundaries.
The widget requires frequent server communication - making requests on load, updating views based on user interaction, and awaiting responses.
Considering these factors, would embedding the widget directly into the host's DOM and rewriting framework code be a more professional approach? While I'm willing to invest the extra effort if necessary, compatibility requirements with IE8 and the need for seamless viewing on desktop and mobile devices without intruding on the client's website are crucial considerations.