Javascript Widget versues iFrame

I was creating a HTML5 Video Ads widget for my clients websites. So if I need to make it in JavaScript or iFrame?

<iframe src=”″></iframe>

But I don’t think iFrame would be the best method, if I need to hide URL from direct access.

Another option is something like this:

<script type=”text/javascript”>id = ’16’;</script>

<script src=”” type=”text/javascript”></script>



– Resizing is typical to the parent window without smart work.
– Better isolation cannot access anything on the parent page.
– No JavaScript experience required.
– Own independent CSS styles.
– Functional on scripting disabled.



– Full access to the parent page.
– Slow down page as script load before rendering the rest of the page.
– Experience with JavaScript needed on parent page.
– Experience with CSS styles needed on parent page.


So here is conclusion 😉

* You have more control on the design in case of an iFrame.
* iFrame is better in terms of security because cookies stored are different.
* JavaScript widget needs more care on other JavaScript conflict.
* Use JavaScript that writes an iFrame dynamically to avoid direct URL access.


Published by

Sandeep Verma

I’m an Entrepreneur. I’m proud to work as Blogger, LAMP Programmer, Linux Admin, Web Consultant, Cloud Manager, Apps Developer, Searcher. Concentrate > Observe > Imagine > Launch