1. Eliminate Conflicts & Styling Issues
We wanted to make sure the widget would always work and display as expected without breaking what is already on our client’s web page!
During our testing it became clear that the widget would always download and render correctly in an iframe, no matter how the host site was designed and coded. Whereas when the widget was inline, we often experienced CSS and JavaScript conflicts which would affect the way the widget displays.
2. Easy Updating
We wanted to make sure it would be easy to update the widget instantly with enhancements, design changes and so on. If we supplied it as JavaScript, we would not be directly controlling the injection, hence changes would mean contacting your web developer every time and supplying a new code snippet. Using an iframe enables us to manage all updates centrally with no client or third-party developer intervention required.
3. Security
Overall, we consider the <iframe> tag to be the safer approach. Mainly because the JavaScript inside the iframe is running in the context of another page with SSL. Of course there are always security risks but it is definitely better then including an external JavaScript that has a direct access to the DOM tree (or more).