logo
g Text Version
Beauty & Self
Books & Music
Career
Computers
Education
Family
Food & Wine
Health & Fitness
Hobbies & Crafts
Home & Garden
Money
News & Politics
Relationships
Religion & Spirituality
Sports
Travel & Culture
TV & Movies

dailyclick
Bored? Games!
Nutrition
Postcards
Take a Quiz
Rate My Photo

new
European Travel
Action Movies
Bible Basics
Houseplants
Romance Movies
Creativity
Family Travel


dailyclick
All times in EST

Autism Spectrum Disorders: 4:00 PM

Full Schedule
g
g JavaScript / Java Site

BellaOnline's JavaScript / Java Editor

g

User History and Creating a Back Button

Guest Author - Julie L Baumler

JavaScript is often used to create a back button to go back to the previously viewed page. You will often see something like this at the bottom of a web page:

<- (previous page viewed)  (continuation of content) ->


This can be useful. Often, when you finish reading a web page, your mouse pointer is near the bottom of the window, so being able to navigate from the bottom can be handy. However, before you add a history button, there are several important questions to think about:

What does back mean within the context of your web page?
Where do your readers want to go back to?
Where do you want your readers to go?
Are any or all of these likely to match the url in the browser history?

All too often, I find a really great web page from a web search or link that is obviously part 2 or 3 of a larger series. I see a back button, press it thinking that it will take me back to the previous page in the series and end up back at the previous page in my history. I go back to the page I'm interested in, look around and there is no link to an index or the first page in a series. There is a next or forward button, the mirror image of the one I tried, and it goes to the next page in the series. This is probably a bad use of the history feature.

There are excellent uses of the history feature. If you link difficult or unfamiliar words to a glossary, having a back button after each entry in the glossary could make a lot of sense. You may link to the same glossary item from several different places in your site and people are likely to want to go back to the page they were reading after looking up the term.

Also, you need to remember that it is possible that the URL in the history does not go back to the page that your user was looking at previously. There are several ways to use JavaScript to change the content of the page without changing the URL in the history. If you are using one of these features and want to implement a history features, you will need to implement it yourself. The upside of this is that, unlike the browser history, you are in charge of what is in it. The downside is that it will only work with your site.

Once you decide that you do want to implement a history feature, it is very easy to do. All you have to do is link your image to a URL of the form:

<a href="javascript:window.history.back()">Go Back</a>

Or set an appropriate event to call window.history.back()
This site needs an editor - click to learn more!

Add User+History+and+Creating+a+Back+Button to Twitter Add User+History+and+Creating+a+Back+Button to Facebook Add User+History+and+Creating+a+Back+Button to MySpace Add User+History+and+Creating+a+Back+Button to Del.icio.us Digg User+History+and+Creating+a+Back+Button Add User+History+and+Creating+a+Back+Button to Yahoo My Web Add User+History+and+Creating+a+Back+Button to Google Bookmarks Add User+History+and+Creating+a+Back+Button to Stumbleupon Add User+History+and+Creating+a+Back+Button to Reddit




JavaScript & Java Site and Newsletter
RSS
Related Articles
Editor's Picks Articles
Top Ten Articles
Previous Features
Site Map


For FREE email updates, subscribe to the JavaScript / Java Newsletter


Past Issues


print
Printer Friendly
bookmark
Bookmark
tell friend
Tell a Friend
forum
Forum
email
Email Editor


Content copyright © 2014 by Julie L Baumler. All rights reserved.
This content was written by Julie L Baumler. If you wish to use this content in any manner, you need written permission. Contact BellaOnline Administration for details.

g


g features
Hearing Dog Tool - Adding Randomness

Hearing Dog Training Tool setTimeout()

GCJ - an Independant Java Implementation

Archives | Site Map

forum
Forum
email
Contact

Past Issues
memberscenter


vote
Poetry
Daily
Weekly
Monthly
Less than Monthly



BellaOnline on Facebook
g


| About BellaOnline | Privacy Policy | Advertising | Become an Editor |
Website copyright © 2014 Minerva WebWorks LLC. All rights reserved.


BellaOnline Editor