Navigation history access

  • 1
  • Question
  • Updated 7 years ago
  • Answered
Can anyone help with some code (HTML preferably but Javascript ok) that will "remember" a visitor's path and allow return to a point in that path (like the "History" page in FF) ?
Photo of Philip Taylor

Philip Taylor

  • 355 Posts
  • 66 Reply Likes
  • unsure

Posted 7 years ago

  • 1
Photo of Brianna

Brianna

  • 2045 Posts
  • 92 Reply Likes
Hello Philip,

Thanks for bringing this to our attention. Are you hoping to implement this on your website so that website visitors can track their history while on your website, or do you want something that you can use to see where your site visitors are viewing from?

Looking forward to working with you further.
Photo of Philip Taylor

Philip Taylor

  • 355 Posts
  • 66 Reply Likes
Thanks Brianna. I want it as a tool for visitors to use - to get back from referred pages on my site. I know the Back button on FF lets them sort of do this, but the page names they see are rather cryptic.... a string of numbers.
Photo of Gop

Gop

  • 189 Posts
  • 54 Reply Likes
There is quite a bit of information on creating "breadcrumb trails" or simply "breadcrumbs" for websites. Some programs have been developed but generally they are server side scripts. Of the site side scripts there have been a limited number created for the popular website systems such as Yi, Wordpress and a few others. I don't think that there has been anything of note (as yet) for other open site builders. having said that there is also a system for Dreamweaver which I hadn't heard of and came across it as I too was looking for automation of this kind.

Creating a breadcrumb trail manually is not so difficult because there is generally only one route in along your site so to add a trail at creation time is not so bad. Breadcrumb trails don't extend out of a site and only have value for two or more sub-levels. There is a lot written on the background and approaches, design and implementation. Too much to give just one reference so I think that your best bet would be to chase it up on a search.

I am currently using a breadcrumb trail and its benefits are very good as you suggest.
Photo of Philip Taylor

Philip Taylor

  • 355 Posts
  • 66 Reply Likes
Thanks Gop.
I will do a search on that - half the battle is knowing what the things that you look for are called. I hadn't heard of breadcrumbs. A pretty descriptive name really.
Photo of Sanja

Sanja, Official Rep

  • 10698 Posts
  • 495 Reply Likes
Hello Phillip,

Do you need any further assistance on this or has Gop set you in the right direction?
Photo of Philip Taylor

Philip Taylor

  • 355 Posts
  • 66 Reply Likes
I've tried a couple of ones I found on Google, but neither did just what I wanted. I'm sure there's one out there that I can adapt though, so close if you like. Thank you all for your help.
Photo of Sanja

Sanja, Official Rep

  • 10698 Posts
  • 495 Reply Likes
Hi Phillip,

If you see an example you've seen on other sites that you like, please direct us to those sites. We can maybe suggest further alternatives.
Photo of Philip Taylor

Philip Taylor

  • 355 Posts
  • 66 Reply Likes
Thanks Sanja. I've been trying to get this script to work, as it seems to have the features I want, but all I can get is two back-slashes on the bottom of the page. I think it may be either my website url, or the format that I'm using for placing the file on my site, or both. I'm trying to come to grips with Javascript but still very green. Hope someone can help. (the only change I've made to the original is to the Domain Name in the first line).
//////////////////////////////////////////////////////////////////////////////
// Nifty Breadcrumbs Script //
//
// INSTRUCTIONS:
//
// 1. Create your site structure using folders and files with useful names.
// You may choose any character you'd like to replace spaces in your
// URLs. I recommend using underscores (as in the example below), but
// this script will allow you to specify any single character you'd like
// to be the replacement for spaces. If you use something other than
// underscores, you will need to make a change in the variables section.
// EXAMPLE: http://www.squid.com/My_Pet_Squid/Mee... shows good
// name choices to describe an area of content and the contents of a page.

// 2. Fill in the settings for the variables in the next section of this
// script. They should be pretty self-explanatory.
//
// 3. Add the following to your site wherever you want your breadcrumbs
// to appear (change the path to point to wherever you put this script):
//
//

//
//
// LICENSE:
//
// This script is protected under General Public License (GPL). Feel free to
// redistribute this script, so long as you do not alter any of the contents
// specifying authorship. If you add to or modify this script, you may add
// your name to the "Other Contributors" list at the top of this script. As
// a courtesy, please email me and let me know how you've improved my script!
// You may not profit from the direct sale of this script. You may use this
// script in commercial endeavors however (i.e. as part of a commercial site).
//
// Email me here: http://www.paulhirsch.com/contact_me.php
//
// Copyright 2006, Paul Hirsch. All rights specified herein and within GPL
// documentation: http://www.gnu.org/licenses/gpl.txt
//
//////////////////////////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////////////////////////
// Change the following variables as instructed //
//////////////////////////////////////////////////////////////////////////////

// Enter your domain name here,
var url = "painlessprogrammingwithqb64.yolasite.com";

// Enter the word you want to use to describe the home page of your site
var home = "Home”;

// Enter the character(s) you want to use to separate your breadbrumbs
var divide = "»";

// Enter text you'd like to see. You can make this blank as well - "";
var pre = "You are here :: ";

// Enter the character that replaces spaces in your URL (i.e. - or _ or %20)
var sp = "_";

swap = new Array(); // Don't touch this line!
// Remove comments from swap array variables below to put them into use.
// Create additional replacement items by increasing the array number [i] as
// you add more lines.

swap[0] = 'Replace Me|Different Text';
//////////////////////////////////////////////////////////////////////////////
// DO NOT TOUCH ANYTHING BELOW THIS LINE //
// unless you know damned well what you're doing! //
//////////////////////////////////////////////////////////////////////////////

divide = ' ' + divide + ' ';
var a = '' + window.location;
a = a.substring(0,a.lastIndexOf('.'));
var b, code, left, x, y = '';
var foo = '';

left = a.lastIndexOf("/");

if (a.substring(a.lastIndexOf('/')) == '/') {
a = a + root;
}

b = a.substring(left+1);
b = b.replace(new RegExp(sp, 'g'),' ');

code = divide + b;
b = '/' + b;
b = b.replace(/ /g,sp);

a = a.replace(b,'');

if (a.substring(left-1) != '/') {
do {
left = a.lastIndexOf('/');
b = a.substring(left+1);
b = b.replace(new RegExp(sp, 'g'),' ');

code = divide + '' + b + '' + code;
foo = '../' + foo;
b = '/' + b;
b = b.replace(/ /g,sp);

a = a.replace(b,'');
} while (a.substring(left-1) != '/');
}

code = code.replace(url,home);
code = (code.substring(code.indexOf(').innerHTML = code;
Photo of Sanja

Sanja, Official Rep

  • 10698 Posts
  • 495 Reply Likes
Hello Phillip,

It looks like you're missing the closing script tag on the code. It might be better for you to post your question on this thread: http://forum.yola.com/yola/topics/got...

There are some really great Community Forum members who are very handy with this kind of stuff!
Photo of Philip Taylor

Philip Taylor

  • 355 Posts
  • 66 Reply Likes
Thanks again Sanja. I'll do that.