Link to home
Start Free TrialLog in
Avatar of markschenkel
markschenkel

asked on

When to use javascript or <object> tag

I have an application which dynamically creates jpeg based charts which can embedded into other web sites.  I need to make available a script or code snippet which web publishers can copy and paste into their code.  This code will then pull the graphic from my site when their page is served.  It is more or less how Google Adsense works.

I have been able to successfully get it to work using the object tag (see sample below).

Would using some sort of javascript be a more robust solution?  I ask because I notice that Google Adsense uses javascript instead of a simple object tag.  If I use the object tag method, is there a better chance my content will be blocked by firewall security programs?
<OBJECT DATA="http://www.mysite.com/getjpeg" TYPE="image/jpg">

Open in new window

Avatar of Piotr D
Piotr D
Flag of Poland image

Why don't you just use

<img src="http://www.mysite.com/getjpeg" />

?
Avatar of markschenkel
markschenkel

ASKER

Yes - I suppose that would work fine.  Is this a common thing?  What would happen if mysite.com goes down?  Would it cause major delays on the "parent" page or even cause it to time-out?  
Some additional information.  Accompanying this graphic there would be a clickable link back to the site (like a "Powered by").  I know this could still be included in the object tag.  But I would want control over this and prevent it from being suppressed.  Is this why javascript would be used in this situation?  With javascript it is as the browser/client and not the server.
ASKER CERTIFIED SOLUTION
Avatar of Piotr D
Piotr D
Flag of Poland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Michel Plungjan
1. you mean

<script type="text/javascript" src="http://myserver.com/myscript.js"></script>

And fully qualify the paths to your server

2. why escape/unescape?



document.write('<a href="http://myserver.com/my_page_link.html" target="_blank" title="Powered by My Page"><img src="http://myserver.com/logo.jpg" border="0" /></a>');

Open in new window

Well, you can use an un-encoded form, it should not cause any problems.