Javascript Breadcrumbs script

  • 1
  • Question
  • Updated 7 years ago
  • Answered
I've been trying to get a "breadcrumbs" Javascript script to work on my website, with no success so far... Maybe you can help ? (I have very limited Javascript knowledge).
I want visitors who enter my website (about 20 pages) to be able to retrace their steps or jump back to a page they've visited, by clicking a small link at the bottom of the page.
I seem to get tangled up when I try to reference a ".js" script, which I placed on a separate page, with a Text widget, and also with an HTML widget. Also, when it asks for my website URL, should I give the HTTP bit as well?
Photo of Philip Taylor

Philip Taylor

  • 355 Posts
  • 66 Reply Likes
  • confused

Posted 7 years ago

  • 1
Photo of Philip Taylor

Philip Taylor

  • 355 Posts
  • 66 Reply Likes
No response yet...
For what it's worth, I've built my first (very small) Javascript thingy, that gives a "back" function at the bottom of my page, taking you back to the last page you came from, and this is it:

<!--

<script language="Javascript" language="text/Javascript">
document.write("<center><a href="+ document.referrer+">Back</a></center><br>")
</script>

-->

Impressive, hey? Oh well, every journey starts with a single step.
Now all I gotta do is build a line of links as visitors move around the site. Easy ! ???
I'm sure someone will accept this challenge.
Photo of Sanja

Sanja, Official Rep

  • 10698 Posts
  • 495 Reply Likes
Hi Phillip,

I'm wondering if you're perhaps trying to use a complicated method to achieve this? Could you not just manually add text links to the bottom of your page, instead of using javascript?

For example, if you have 3 pages, on the 1st page it would like this:

First Page

Second page:

First Page > Second Page

Third page:

First Page > Second Page > Third Page

Each will be a link to your page in the site?
Photo of Philip Taylor

Philip Taylor

  • 355 Posts
  • 66 Reply Likes
Thanks for the reply Sanja.
No, I have already done this, in a way, by having the website set up in "chapters", the pages in a chapter having HTML links to each other. But there is a total of twenty-odd pages, and having links to each on every page would be a bit messy. I use the Yola-provided links at the top for chapter links.
I'm actually finding that the single "Back" link I made works quite well, especially in the Glossary page which will often get referred to from any page. The link transfers the visitor back to where they jumped from. It has the extra bonus that I can have several links for the same word throughout the site and it returns them to the correct page.
Having said all that, I'd still love to see what a "real" breadcrumbs function would do, and it would be valuable in helping learn some Javascript.
Photo of Brianna

Brianna

  • 2045 Posts
  • 92 Reply Likes
Hi Phillip,

Unfortunately I am not too trained in this matter and will be unable to assist you. I am hopeful that a member of our community will be able to enlighten you with Javascript.
Photo of Philip Taylor

Philip Taylor

  • 355 Posts
  • 66 Reply Likes
Thanks Brianna.
I've asked for help from a member who offers free scripting advice, and I'm waiting to see if he can help.
In the meantime I'll read my book and experiment a bit more.