HOW: Rotating Banners On Webpage w/o JS or CGI

Posted on 1998-09-20
Medium Priority
Last Modified: 2013-12-16
I was on this webpage: http://javaboutique.internet.com/Jannal/

And they have a banner at the top/bottom of their webpage.  Everytime I load this page (I access the webpage and see a banner, then, close Netscape and access the webpage again -- I do not hit reload) it shows a new banner.  How do they do this without Javascript and a CGI script?  The banner is cached as well and so you'd think that when I go to access the page again (without reloading) it would fetch everything from cache!  Could SSI be involved even though the webpage doesn't have the extension .SHTML?

This is exactly what I want to do but I could only figure out doing such a trick with a call to a CGI-Perl script and noting the IP address of the user to just in case he/she clicks on the banner so as to return the proper URL.  The CGI script would return back the next image banner and place an Expires date on it.

The banner system this webpage is using seems less cumbursome then my webpage.  If you can tell me the method they use to do their banner system I'd be VERY grateful!  I must figure out this problem!

Thanks and good luck!
Question by:ratboy
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2

Author Comment

ID: 1837978
Edited text of question

Author Comment

ID: 1837979
Edited text of question

Expert Comment

ID: 1837980
Looks like a site configuation to me.  The whole site has the same layout.  Nice site, but kept crashing my ie4 browser with the java on the pages.  If not too fussy on what banners, could always look at link exchange.  Alternatively, you could use perl or javascript/vb script to do it, but this as you said is cumbersome.
Sorry not too helpful.
Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

LVL 11

Accepted Solution

mouatts earned 200 total points
ID: 1837981
I can't tell you exactly how this site does it but I think that it does it in more or less the same way as one I developed. If I explain that then the differences will only be minor details.

Firstly in case you aren't aware whenever a webserver outputs a page of HTML it parses the head section first. It does this so that it can convert and HTTP_EQUIV META tags in to HTTP messages that will be transmitted ahead of the HTML.

So what we do is to intercept this process and allow our own code to continue the parsing of the rest of the HTML page. Inside this page we place special tags which basically indicate were the banner is to be placed.

Typically these tags might look like this

<!--$ADVERT -->

As we parse the file we find this tag and replace it with the banner HTML.

Our processing at this point will determine which advert we are going to output. Typically we will have a file that will contain details of each potential advert along with a counter that denotes which one is to be displayed next.

In fact at this point you known what page you are processing so you can decide to use a different database for each page thus increasing the potential number of sale slots that you have.

In a similar vain page counters can be implemented in this way as well without the burdon of code to manipulate graphics as you simply output the appropriate HTML for each counter figure rather than a single images with all the characters processed into it.

The method to do all this is not CGI but NSAPI with the Netscape Server, ISAPI with IIS/PWS and whatever the API for Apache is for Apache. With the Java based servers a Java Servlet will have been used.

The fact that you see the banner in the cache but that this cached version does not appear to be used is indicitive of an already past expire date being associated with the images and HTML. The HTTP prototcol states that when the object is received it should be placed in the cache (except when a no-cache pragma is issued) and the expire date check when the page is NEXT requested. Consequently by setting the expiry of an object to be in the past when the page is next accessed it will find that it is out of date and send a conditional request to the server which will respond by stating that the page is out of date and here is a new one.

An alternative approach is to use a no-cache pragma HTTP message which will prevent the objects being cached at all but some older browsers didn't support this so there is a tendancy to utilise the expiry method instead. (However no browser that supports Java doesn't support the no-cache so there is no real point in this case).

Incidently you should realise that when you start up your browser all cached objects are check against the server unless you have the verify documents flag set to never.

Lastly don't be fooled into thinking that because something has a particular extension that it a particular file or type of processing. If you have access to the server and have a mind to you can make anything look like anything else. For example I have seen a references to index.html were index was the name of a PL/SQL Package in Oracle and .html was the name of a procedure within the the package. Thus rather than a page of HTML it represented a 'CGI style' call.


Author Comment

ID: 1837982
So then you're saying the page is actually getting its banners inserted by the server, much like SSI code is parsed from an HTML?  Ok I can accept that but for the banner not caching, how is this done?

The grapical banner is inserted as an <IMG> tag and is actually a GIF picture file (no call to a CGI script).  How does this graphical banner, then, set itself to NOT be cached?  Does the server also send back a PRAGMA: NO-CACHE or EXPIRES:  header?  And if it does, these 2 headers don't seem to work in Internet Explorer 3.  That is, when you use these headers the graphic is still cached no matter what.  However, the HTTP webpage mentioned (http://javaboutique.internet.com/Jannal/) shows signs of 'not' caching in IE.

Please help me understand exactly what is going on, and can an APACHE server help me achieve all these effects for my website, and is there a simpler solution to achieve the exact effect?

Thanks a bunch EVERYONE!
LVL 11

Expert Comment

ID: 1837983
SSI is done as part of the parsing of the HTML so the two are related.

The HTTP pragma nocache is issued to prevent caching of the image. This does work in IE3 but at times seems a bit pickey when it comes to the exact format of the message.

Incidently older browsers didn't support nocache and a trick was to send no-cache and expires so that if one trick didn't work the other would. However these two messages according to the HTTP definition of there role makes them exclusive as the expires message should actually cache the element when received and only check the expiry date when the element is next accessed even if the expiry date is passed when it is first received. Therefore if you send both headers to a browser it has to make a choice as to which one it will ignore. I seem to recall that netscape 3 ignores the expires and IE 3 ignores the nocache. However it maybe that the order of the messages has an effect.

You can achieve this technique with most servers including Apache. The technique that I mentioned would be differcult with Oracle Web server and not the best way of doing things with IIS (where you would use ASPs ad rotator object).

There are a number of other ways that you can achieve the same sort of effect including using server push and CGI techniques which is the simplest really depends on your own areas of experience.

If you are patience I am currently writing a document on this very subject which will be on my Web site when it is relaunched next month. (www.bedrockcomputers.demon.co.uk)

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
Originally, this post was published on Monitis Blog, you can check it here . Websites are getting bigger and more complicated by the day. Video, images and custom fonts are all great for showcasing your product or service. But the price to pay in…
The purpose of this video is to demonstrate how to add AdSense Ads to a WordPress Website, and how to set up WordPress to automatically place Ads in Sidebars. This will be demonstrated using a Windows 8 PC. Log into your AdSense account. : Cli…
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question