[thelist] Breadcrumb Trails

Hassan Schroeder hassan at webtuitive.com
Sat May 5 12:14:15 CDT 2001


Aaron Clark wrote:
> 
> What kinds of technologies/tips/shortcuts do you all use for creating breadcrumb trails? I would prefer a client-side solution rather than doing server-side processing, but I'm open to suggestions.

and in response aardvark wrote:

> client-side?  you mean, rely on the history object through
> JavaScript?  how do you handly non-JS browsers?  or write code to
> handle all of 'em?  ultimately, if it can be done on the server, do it
> on the server... that being said:

I agree with the suggestion to do server processing where possible,
but --

Most "breadcrumb" implementations aren't actually a history trail, 
just a reflection of the information hierarchy of the server. 

If the URL of your document is

	http://www.foo.com/this/is/my/path/here.html

it's simple JavaScript to create a pseudo-breadcrumb string like

	> this > is > my > path > here  

/* serving suggestion */

<script language="JavaScript">
var breadcrumb = new String(location.pathname.substring(0, location.pathname.lastIndexOf(".")).replace(/\//g, " > "));
document.write(breadcrumb);
</script>

FWIW!
-- 
H*
Hassan Schroeder ----------------------------- hassan at webtuitive.com 
Webtuitive Design ---(+1) 408-938-0567 --- http://www.webtuitive.com

    -- creating dynamic Web sites and applications since 1994 --




More information about the thelist mailing list