Iframe Vs Javascript Tags

Iframe and JavaScript are the most used third party tags or at times the combination of both the tags are also there , just like the DART Iframe tags , you will find iframe , javascript and also standard tag in combination.
The combination is formed because not all browsers recognize the Iframe HTML element.And if the browser doesn’t support Iframe it will render the jscript tag and if the browser does not support javascript(which is very rare) it can always use the standard tag.

But the question is what is the difference between an Iframe tag and a JavaScript tag.To explain the difference let’s know them first…


The “I” in Iframe is Inline and the Iframe element is used to define an inline frame for the inclusion of external objects including other HTML documents. An iframe is somewhat same as an object (“an object element is used to include objects such as images, audio, videos, Java applets, and Flash animations“) as it provides the same functionality as an object .

An Iframe tag is the one which allows an HTML page to be embedded in another HTML page.As the browser finds the iframe keyword it understands and searches for the source from where to find the HTML page to load into the Iframe.. i.e for example in a DART Iframe tag :

<IFRAME SRC=”http://ad.doubleclick.net/adi/Nxxxx.xxxxxx/Bxxxxxx.y;sz=300×250;ord=[timestamp]?” WIDTH=300 HEIGHT=250 MARGINWIDTH=0 MARGINHEIGHT=0 HSPACE=0 VSPACE=0 FRAMEBORDER=0 SCROLLING=no BORDERCOLOR=’#000000′>

http://ad.doubleclick.net/adi/Nxxxx.xxxxxx/Bxxxxxx.y;sz=300×250;ord=[timestamp]? is the source from where the browser will get the HTML page which is actually the Ad that will appear on the webpage (in case of online advertising).

WIDTH=300 HEIGHT=250 MARGINWIDTH=0 MARGINHEIGHT=0 HSPACE=0 VSPACE=0 FRAMEBORDER=0 SCROLLING=no BORDERCOLOR=’#000000′   is the dimension or box defined for the frame where the tag will load , the size defined of a frame in the above code is 300×250 , this defines the Ad won’t go beyond this frame size and thus we don’t upload any expandable tag under Iframe as when it expands it will open under the frame only .

Advantages of IFRAME TAGS :

  • The browser allocates some space for an inline frame beforehand and takes this into account when rendering the document.
  • Iframes implement the cross domain origin policy which can be useful for pulling in sites / content/Ad from other domain names and they are also relatively safe and that is why most of the web advertising solutions are based on iframes.
  • If contents to be loaded first and then Ads , it can be done using Iframe.
  • Iframe helps in improving performance.
  • Iframe loads independently from other components on the page.
  • If a user has javascript disabled, iframes will work.
  • An iframe tag has attributes “height” and “width,”  which allows the designer great latitude with dimensions and format like 300×250 , 728×90 depending on the Ad size.
  • Iframe tag can appear anywhere on the page and several iframes can be added if wished to.

Disadvantage of IFRAME TAGS :

  • It causes accessibility problems.
  • It is not supported by all the browsers and can display them improperly or even can serve blank.
  • The main reason for using in web advertisement is security in cross domain support but performance is not perfect.
  • Iframes can not be seen by many handhelds.
  •  It lowers your SEO score at times.
Example of a Iframe tag (eye blaster) :


These tags are encoded within script and tells the browser to read as JavaScript the content retrieved from the source (SRC) location. JavaScript tags are useful for sites that already use their own Iframes for complex page layouts, or for publishers who would prefer not to use Iframes.

Tha JavaScript tags are embedded directly into the HTML document so if any site layout or ad delivery requirement demands embedding of ad code directly into HTML doc , javascript tag is used and not Iframe tags.If we have to serve expandable Ads we cannot use Iframe but javaScript only.

Advantage of JavaScript tags :

  • The majority of browsers supports Jscript.
  • Javascript tags help in serving any expandable banners.
  • Multiple ad sizes can be served using same serving code at same place ,(e.g. 468×60 and 728×90)
  • It puts less load on the server to load.
  • An iframe can only be rendered into a single place but javascript does not have such rule.
  • It is supported by almost all handhelds.
  • No accessibility issue.

Disadvantage of JAVASCRIPT TAGS :

  • If the Javascript is disabled by the user , it will serve only the standard banner and not flash content.
  • They are not loaded independently of the content in a webpage

Example of a JavaScript tag (double click tag) :

<SCRIPT language=’JavaScript1.1′ SRC=”http://ad.doubleclick.net/adj/Nxxxx.xxxxxx/Bxxxxxx.x;sz=300×250;ord=[timestamp]?”></SCRIPT><NOSCRIPT><A HREF=”http://ad.doubleclick.net/jump/Nxxxx.xxxxxx/Bxxxxxx.x;sz=300×250;ord=[timestamp]?”><IMG SRC=”http://ad.doubleclick.net/ad/Nxxxx.xxxxxx/Bxxxxxx.x;sz=300×250;ord=[timestamp]?” BORDER=0 WIDTH=300 HEIGHT=250 ALT=”Advertisement”></A></NOSCRIPT>

12 thoughts on “Iframe Vs Javascript Tags

  1. Suhash

    One of the good thing, which often gets ignored. Similar to difference between == and === in JavaScript.

  2. Manikandan

    Thank you so much for sharing this info. Great 🙂

  3. Naveen Krishna M

    Hi All,

    I have 3.5 years of experience in ad operations.

    Please let me know if any interview available.

    Naveen Krishna

    • I saw some of the replies below and it is nor recruitment site.


    • savith

      Hi Naveen,

      Reach me on savith.desiraju@gmail.com with your current location and resume. Will see if I can help in our firm. Thanks for the info.

  4. Really very much thankful for this piece of code of serving ad through Javascript. I will try it on my sites.

  5. Thanks, I was looking for the difference and only your site did a decent job of it.

  6. what’s the best DPS for JS TAGS?

  7. What if we directly use the WordPress embed option? Is it better then writing it on my own?

    • Yes, that’s another option to ease. There is no problem until unless you don’t look to have any customization.

  8. Khan


    Great read. I’m having a difficult time understanding the difference between Iframe Tag and Image Tag? I know Iframe is better but I don’t know the exact reasons.


    • Hey, Please elaborate when you say image tag? As even iframe is an image tag. Iframe is a piece of code with a set of strict dimensions.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>