Saturday, March 1, 2008

Quick Web Tips/Notes, Part One

I always find it interesting as I teach or work in my daily life, how little things that you might accidentally discover may revolutionize your workflow, or maybe add some efficiency to your practices.

While reading up more on web standards and practices, I have come upon two little neat things that have helped immensely with two headaches I have had in the past concerning website creation.

Headache #1: When working with something like a blog where you need some links to launch in a new browser - but you don't want every link to launch a new browser window.

Why a headache: Well suppose you put your blog in as a frame in your website, and it is perfect for the blog size, but external sites look really bizarre embedded in your site (beside the potential for copyright issues). But if every link opens up a new page, every internal link you have also opens a new page, leading to the potential for dozens of open pages.
Well, if you yourself are writing all the content you can always write your own targets for each link, but if you have people contributing who don't write in HTML - well, problem city.

Solution:

Part 1:
Writing code that makes all links launch in a new window. Solves the issue of links appearing inside your frame - but means a new launch window for every link clicked. (I could also write this directly into CSS, but in this example, I don't have access to the CSS)

(using [ instead of < and > so it can be read not as code)

[base target='_blank']
[/base]

Part 2:
Naming the target blank window, so that all links will go to the same window.
[base target='display']
[/base]

Now when you click on a link it will open up a new window, but all future links will open in that same window (named "display").

Neat little bit of knowledge though not hugely applicable for most situations, where you will probably write targets inline, or as CSS. But even in CSS, naming the window vs. having all windows open up is the same.


No comments: