Gary L. Simmons  rev 06/17/03  webwonks.org/WebBuilding/ClientPull.html
Home  Marathon  Joke OT Weak  Web Building  Resumé  Lynx  Hobbies  Extra  Site Map Resume Joke of the Weak Go to the next department

Gary's Web Building

Using Client-Pulls

I had a very large web page here at the House of Wacks for chili peppers. It grew so large that I had to break it down into several pages to facilitate a quick download time and that involved putting the pieces into their own folder. In general you don't want any page to be over 50K at the max and it had grown to 87K not including the graphics! OK, so now I have a problem. No not that one, please don't bring that one up! Sure the police came out to my house twice and once I had to sit in the back seat with my neck handcuffed to my ankle for an hour but that all got straightened out and nobody pressed any charges and I have since sworn off mixing Windex into my Harvey Wallbangers. The problem I'm willing to talk about revolves around the chili page being bookmarked by users or its inclusion in search engine databases. If I just yoink the page and start a new one in a new folder, all of those nice people (hey I only call you guys idiots when you are out of the room) are going to get a 404 error when trying to access the page. What to   do what to do. You do a "client-pull":you strip out the page, leave a "we've moved" sign on it, and tell the users client (his browser) to automatically pull up a different page. Now I've seen this done a hundred times but I had no idea how to do it myself. I didn't know what to call it so I didn't know how to look it up! I did a web search on "we've moved" and clicked on the links to them, if they were examples of the thing I wanted to do I saved the page on hard disk before they moved me to the new page. When I found 2 of them I stopped searching and opened them up and looked at the HTML to see what code was the same in the two pages. That is how I found out about the HTTP-EQUIV attribute of the META tag. I tell you this not so that you worship me as a god (however I am accepting sacrificial virgins) but so that you can slap your greasy forehead and say to yourself, "Hey, I could do that for such and such". So anyway, refill your coffee cup, settle down, and read on to see how you can use client-pulls to do cool stuff.

  • META tags

    I have touched on META tags already on the "Get Noticed" page. META tags have a wide variety of applications, but they primarily include information about a document such as the creation date, author page contents, etc. The information in a META tag is primarily useful to servers, web browsers and search engines but it is invisible to the user. META tags are placed inside the <HEAD> tag.

  • The HTTP-EQUIV Attribute

    The information provided by the HTTP-EQUIV attribute is added to the HTTP response header. This response header contains all sorts of useful MIME type information that the server sends to the browser to tell the browser how to handle the information in the file it is about to receive. If you are like me, you really hate those stupid MIMEs too. The striped shirts, the painted faces, the ambiguous sexuality, the trapped in freakin' the box gag. Gosh, if it weren't for the law and the threat of living in an 8X12 for the next 40 years with some no-neck named Buba, I would take a rusty, red-hot fire ax to the lot of them and hang their pasty, pimple flecked hides to dry on my back fence.

  • META tags for client pulls

    Wow, I broke a tooth I had my jaw clamped so hard! Criminy, where was I? OH! There are lots of predefined HTTP-EQUIV types available but we are only interested in client pulls here so we will focus on the "refresh" attribute value. For a complete listing see the Dictionary of HTML META Tags. As I mentioned in the introduction, a client-pull refers to the ability of the browser (the client) to automatically request (pull) a new document from the server. The effect for the user is that the page displays, and after a predefined period of time, automatically refreshes with new information, is replaced by an entirely new page, or even a file starts downloading! Long ago client-pulls were used for doing crude animation but now much better techniques are available and anyway we are here to learn how to redirect users to a different page when they hit a retired URL.

    The syntax used is:

    < META HTTP-EQUIV="name" CONTENT="content">


    The client-pull uses the refresh attribute value. It tells the browser to wait the number of seconds you specify in value of the CONTENT attribute. If you want your page to refresh automatically every 20 seconds (you do have some updated information the server is going to put there right... RIGHT??) then you would use a statement like this:

    < META HTTP-EQUIV="refresh" CONTENT="20">

    Now if you wanted to send the user to a different URL in 10 seconds the statement would be:

    < META HTTP-EQUIV="refresh" CONTENT="10; URL=http://www.mybuttonascanner.com/">

    Careful now me boyo, notice how the quotes go all the way around the value of the CONTENT attribute. Normally URLs have their own set of quotes, but the delay time is part of that same value.

    Have the page start automatically downloading a file:
    < META HTTP-EQUIV="refresh" CONTENT="0; URL=http://www.mybuttonascanner.com/butt.doc">

    Want a web site that shows off your works of art in a looping slide show? Do something like this:

    Document butt1.html contains:
    < META HTTP-EQUIV="refresh" CONTENT="30; URL=http://www.mybuttonascanner.com/butt2.html">

    Document butt2.html contains:
    < META HTTP-EQUIV="refresh" CONTENT="30; URL=http://www.mybuttonascanner.com/butt3.html">

    Document butt3.html contains:
    < META HTTP-EQUIV="refresh" CONTENT="30; URL=http://www.mybuttonascanner.com/butt1.html">

    Put an easy-to-click link on each page that will take your user out of the loop or he will bail on you the second he starts burping up bits of the road kill he swallowed whole for lunch. Also keep in mind when you set the refresh time, the speed the page (graphics or no graphics) will load depends on file size, server speed and general web traffic. a value of zero will trigger the next page as soon as the current page has downloaded.

  • Sorry for all the confusion

    I have a confession to make. In the "HTTP-EQUIV Attribute" section above I just sort of launched into mimes like a stomach kicked pit bull in a blinded rabid fury for no reason at all. It turns out that MIME means "file type" and it stands for "Multipurpose Internet Mail Extension", not to be confused with "Mentally Incompetent Mole Excrement" as I first surmised. You see, servers add a header to each document that tells the browser the type of file it is sending. The browser determines how to handle the file based on that information. It tells the browser whether it needs to display the contents in a window, or to launch a plug-in or helper application. This system for communicating media types closely resembles MIME which was developed for sending attachments in e-mail and hence my confusion. Boy is my face red. I stand behind each and every word I ranted about mimes though!!

  • An Example!

    If you like you can link to the page I modified to be my Chili Page URL redirect page and see this thing in action. As I stated earlier, make sure it has the exact URL of the old page, and this includes all the invisible named anchors that someone might have bookmarked or linked to! I mean, you never know, anyway it couldn't hoit. One last thing, make sure there is a manual link to the new page that the user can click if for some reason the refresh fails.

Top of Page

Back to Web Building