Object Tag vs. Javascript to embed Ad/Content

I want to enable people to embed content from my site on theirs by simply copying and pasting a snippet of code.  For comparisons sake, this would be very similar to Google Adsense.  Like Google Adsense, the content will not be static but dynamic and contain images.  

I have been able to accomplish my goal with the snippet of code below.  My question is, what advantages does using JavaScript have over the methodology I am employing?

<object width="200" height="400" data="http://www.mysite.com/showad?mysite_ad_client=933392031200&mysite_ad_slot=30329077" type="text/html" >

Open in new window

Who is Participating?
MikeRCWattsConnect With a Mentor Commented:
I just tried it cross domain and found my IE security settings prevented the load of the object contents just as you say - sorry, should have checked more carefully not just with local +remote.

Either way, it makes lots of sense to use Google's scheme as it will be well tried and tested...copy with pride...
<object> is popular and very widely used for embedding active content like videos, less so for text.

A disadvantage is that IE appears to display a vertical scrollbar even when not needed (remove with css style in the included document-  html { overflow: auto; } and you can remove the border with html { border: none;}

Using a Javascript formulation can give you more control, if you need to sense anything about the containing document's properties or environment.

An advantage of the <object> tag over Javascript is that it can work in a browser which has Javascript disabled, though that is rare.

See this link for some tests and examples (if you haven't already)  http://joliclic.free.fr/html/object-tag/en/object-text.html#html

It may also be looking at the effect on the page loading , as different techniques like Javascript execute at different stages in page loading, and whether there is any effect on caching.  Security looks unaffected by choice of methods to me for including text?


markschenkelAuthor Commented:
Thanks for the reply.  Actually I will be embedding a combination of html and a image.  The image is a graph which changes from day to day.

I did some more research on this.  The biggest drawback using the <object> tag is Microsoft Explorer comes by default with "Access Datasources Across Domains" unchecked.  Because the content in the object tag is coming from a different domain, it will simply display an empty box.

I did more research Google AdSense.   Someone says that it utilizes IFRAMES.  Is this correct?  So if I rewrite my <Object> to be a <IFRAME>  it should display on any page where Google Adwords can be displayed?
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.