Solved

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

Posted on 1998-09-20
6
245 Views
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!
0
Comment
Question by:ratboy
  • 3
  • 2
6 Comments
 

Author Comment

by:ratboy
ID: 1837978
Edited text of question
0
 

Author Comment

by:ratboy
ID: 1837979
Edited text of question
0
 
LVL 1

Expert Comment

by:development
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.
0
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 
LVL 11

Accepted Solution

by:
mouatts earned 100 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.

Steve
0
 

Author Comment

by:ratboy
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!
0
 
LVL 11

Expert Comment

by:mouatts
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)
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Suggestion on WebSite Template Sites 6 58
Help with HTML 7 39
Windows 10 bookmarks html file 6 30
Bootstrap 3 icons 3 13
When setting up new project requests for our site, one of the most powerful tools our team has available to use is Axure (http://www.axure.com/). It’s a tool for creating software and web prototypes that can function and interact as if it were the a…
This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

746 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now