Webmaster Tutorial Menu
Tutorial Home
Life before .htaccess
You have to start somewhere
Becoming a Webmaster
The steep learning curve
What to look for in books
How many hats?
Technical Job Description
Linux or Microsoft?
Standard web stuff
Basic HTML
Frames and/or Flash?
Site submission
Negotiating Links
Validating your HTML
Web safe fonts
Web safe colours
Different screen & monitor sizes
Cascading Style Sheets (CSS)
'Nix specific stuff
Choosing a 'Nix hosting company
Web Logs Demystified
Web Log Status codes
Limitations of robots.txt (and the power of .htaccess)
cost  effective,   fast  loading,   lightweight,   high  return  websites

Javascript (and pop-up windows)

So, what else did I need to find out about?
Javascript - but I didn't know it was javascript I was looking for.
When people clicked on an external link in my first site ("Harry's Letters"), I wanted a new window to open. Simple: target="_blank"
The problem with this was that I had heaps of external links and each time a surfer clicked on a link they got another new window.
As with most functionality I employ on my sites, I think about what I would like to see; I think about the way I would expect the site to behave. I also try to put myself in the shoes of someone with little or no experience.
With this in mind I decided that I wanted the same new window to be reused over and over again. Seemed simple again: target="harrysWindow"
Yes... but... I discovered that this worked fine the first time, but was as good as useless for the second and subsequent clicks. Theoretically it worked fine - the new site appeared in the reused harrysWindow, but the window remained underneath the current window (ie. not visible in most cases).

A real world example of poor design

As an aside, I occasionally train people in using the web.
One of the most common aims, particularly of older members of our community, is to book an airline ticket.
The online booking system for Australia's major airline (Qantas) has (still!) a small pop up window for error messages. If the user neglects to close this window - quite common because it's so small - the next time they get an error message they do not see the message because it is displayed in a window underneath the window currently being viewed. The person attempting to book the ticket sits there wondering what is happening - presses 'submit' - nothing happens - presses submit harder - still nothing.
It amazes me that systems that cost millions of dollars to develop, are rendered unusable due to such fundamental errors in the user interface.
The oddest (sadest) thing about this example is that they used javascript to implement the pop-up window - meaning they had at their disposal a very simple means of giving the error message window visibility (or "focus"), as shown below.

Opening a new window and giving it focus

After a little research I found that what I wanted was to use javascript to do the window opening and give that window focus. [I also found out that not everyone uses javascript - or at least not everyone has it "switched on" but I eventually came to the conclusion that most of my surfers would have it set on by default.)
So I diligently went about changing all my links to
<a href="javascript:harrysWindow ('http://blahdeblah.com/')" etc>.
I then started to use the same technique on my business site (with informational pop-up windows)... and then discovered that search engine robots do not follow links embedded in javascript commands!
This can easily be overcome by putting in a site map, which also adds to human usability. However, a site map does not necessarily provide anchor text links (a nice to have). Also, some pop-up window blockers do not allow a window to be opened like this (directly from the "href" part of the link).

Opening a new window, giving it focus and having a robot friendly text link

I then discovered that I could combine the two techniques. The result is as follows:
<a href='http://blahdeblah.com/' target="harrysWindow" onclick="javascript:harrysPopup()">
If you want to see the code that goes into the harrysPopup javascript, have a look at the source of this page (replacing the words "bpNetPop" with "harrysWindow"; and "pu" with "harrysPopup").
All external links in this tutorial reuse the same window (in other words the following link is an example). You will need to refer to a javascript reference manual for more details on the specific options, especially on the window.open command.

Navigating users to my real site from a pop-up window

I then realised that if surfers came in on my menu-less informational pop-up windows, they had no way of navigating to my real site. Bummer - a potential customer lost.
Without going into tons of detail, I devised a way (using javascript again) to provide a common, standard menu in the pop-up window that worked differently depending on how the surfer got there.
Simply, if they arrived from outside my site, the menu allowed them to navigate around my site as per normal. However, if they arrived at this page as a pop-up window then clicking on the menu would take them back to the original window and send them to the requested page.
At the risk of sounding immodest, it was one of the most satisfying things I have ever done on a website. One of the funniest / sadest things about it is that no-one should ever notice that it's there (that's the whole point in having it!) The trick is simply in that the pop-up window I create has a specific name (harrysWindow), whereas if they come in from a search engine, it has no name. The menu behaves differently on that basis. [I'll leave you to explore my site to find out where it exists.]

So what did I find out?

Firstly, Javascript has nothing to do with Java (and Java has nothing to do with coffee - but that's another story).
There are thousands of javascript tutorials with lots of free scripts (and excellent examples of pop-up and pop-under windows aplenty - what better place to find the most insiduous forms of javascript annoyances than a javascript geeks' site!).
Not all javascript is created equal (but then it's more equal than html in many respects).
Not all browsers support javascript (but this is largely irrelavent depending on your audience).
Most search engine robots do not follow javascript links embedded on the "href" portion of an anchor link.

[Content of this page last reviewed: 30-Apr-1011]
_ _
copyright © 2001-2007 bpresent
Terms of Use, Privacy Policy, Copyright and Trade Marks
Sydney +61 438 726 669