Javascript for a navigational bar

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
User avatar
jdhorton77
Forum Commoner
Posts: 56
Joined: Tue Nov 07, 2006 3:29 pm
Location: Charlotte, NC

Javascript for a navigational bar

Post by jdhorton77 »

I'm trying to come up with a navigation bar and I have a good idea for the logic, but I'm coming up with a kink in my plan. Here's my situation. I want to populate an array with anchor tags of the history object. I know that you can go back previous pages with history.go(-2) but I'm not sure how to check the url of the history without it loading the page. I'm trying to check the url of the history to reference a list of url's so I can write whether it's the home page, gallery, or what have you on the navigation bar. Anyone got any ideas?
nickvd
DevNet Resident
Posts: 1027
Joined: Thu Mar 10, 2005 5:27 pm
Location: Southern Ontario
Contact:

Post by nickvd »

What would happen to your navigation menu if the user does not have javascript enabled?
User avatar
jdhorton77
Forum Commoner
Posts: 56
Joined: Tue Nov 07, 2006 3:29 pm
Location: Charlotte, NC

Post by jdhorton77 »

Good question, didn't really think about that. Do alot of people disable Javascript? I guess I could just enclose it with html comment tags to disable the script.
User avatar
Luke
The Ninja Space Mod
Posts: 6424
Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA

Post by Luke »

I wouldn't use javascript. I'd set up some kind of system where depending on the page you are on, php (or some other type of server-side technology) knows how to build a path of links to that page. Depending on browser history is just asking for trouble.
User avatar
jdhorton77
Forum Commoner
Posts: 56
Joined: Tue Nov 07, 2006 3:29 pm
Location: Charlotte, NC

Post by jdhorton77 »

Yeah, I actually just found a tutorial stating how to creat a "Breadcrumb Trail" using the directories to the current page. I guess I could do this, but the problem is that if a page goes from an http to https protocol the directories are two different locations. For instance, lets say a user logs in and is located at the user home page within the https directory. If the user wants to view the image gallery, within the http directory. Then move to customer check out, which is back in the https directory, then the navigation links will be all screwed up. Any comment on this perdicament?

Also, I have thought about placeing the majority of the pages within the https directory to fix this problem. What are the consequenses of this. Is there a great difference in transfer time between https and http? And what other problems do you see arising from this?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

We've had a few discussions on breadcrumbs.. ;)
Post Reply