Solved

Custom History Back and Forward buttons for IE

Posted on 2002-06-29
13
295 Views
Last Modified: 2008-03-04
I have a javascript tool bar that has a back button and a forward button on it.  i need these 2 buttons to work exactly the same as the Back and Forward buttons on the IE button toolbar at top (which i hide when i open the window).  i know the back button works with window.history.back() but i cannot get the forward button to work and i can't find the javascript for it.  Is there some way i can do this by accessing the history array?  if so, i'd also like to take out the 1st 2 items in the history for this window (my login scripts) so that the user cannot go back to it.

there is one other thing i must let you know about this toolbar for it to all work properly.  The toolbar resides in the top frame of a frames page.  i need the forward and back buttons to change the body frame, not the top frame.

thanks,

~ MastaLlama ~
0
Comment
Question by:mastallama
  • 7
  • 5
13 Comments
 
LVL 44

Expert Comment

by:bruintje
ID: 7119068
Hi mastallama,

from
http://www.sbrady.com/hotsource/javascript/back.html


<form>
<input type="button" value="Back" onclick="history.back()">
<input type="button" value="Forward" onclick="history.forward()">
</form>

HAGD:O)Bruintje
0
 
LVL 3

Author Comment

by:mastallama
ID: 7119075
yes, that works!  thanks, but... there is one problem...

how do i target the bottom frame???
0
 
LVL 44

Expert Comment

by:bruintje
ID: 7119094
Hi mastallama,

how about
<INPUT TYPE="button" VALUE="Click Here" onClick="parent.FrameName.location.href='history.forward()'">

but i'm not sure about that

HAGD:O)Bruintje
0
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 
LVL 3

Author Comment

by:mastallama
ID: 7119100
yes, that works!  thanks, but... there is one problem...

how do i target the bottom frame???
0
 
LVL 3

Author Comment

by:mastallama
ID: 7119101
oops, sorry, i refreshed the page...hee hee

forget that last comment, lemme try the parent.FramName and i'll get back to ya!

hee hee
0
 
LVL 3

Author Comment

by:mastallama
ID: 7119104
that works but brought up another problem...if there is no forward page, the forward button is still there and active and gives me a blank page.  can i test the # of pages in the history and hide the forward button when you can't go no forward, or hid the back button when you can't go back anymore (just like IE) ?

~ MastaLlama ~
0
 
LVL 44

Expert Comment

by:bruintje
ID: 7119174
Hi mastallama,

completely missed your last comment, this code let you check the length of the history and the number of pages hence and forth

http://www.suite101.com/article.cfm/javascript/48508

HAGD:O)Bruintje
0
 
LVL 19

Expert Comment

by:webwoman
ID: 7121921
Do you have a particular place you want to go from each page? Otherwise, there ISN'T any 'forward' -- you can't call something that hasn't happened yet.

If you know what you want to be the next page, hard code that in. You can actually javascript it so that the link is different based on where they are.
0
 
LVL 3

Author Comment

by:mastallama
ID: 7121939
no, the forward needs to work just like the IE forward...if someone clicks back, then they can come back to the last page by hitting forward, so in fact it has happened already, i just need to access it again.
0
 
LVL 44

Accepted Solution

by:
bruintje earned 50 total points
ID: 7121972
have you read that article as it seems to all is in there even how to get the length of the history
0
 
LVL 3

Author Comment

by:mastallama
ID: 7122013
yea, i've read it and i'm testing it right now
0
 
LVL 3

Author Comment

by:mastallama
ID: 7154874
Thanks Bruintje!  It works perfectly now!
0
 
LVL 44

Expert Comment

by:bruintje
ID: 7165483
great to hear that
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
jQuery Validate 4 36
how can i apply an assert arrayEqual function ? 2 24
How can i  prevent default  Submision? 6 24
DataTables + iCheck + pagination Issue 2 16
Today I would like to talk about localizing (Internationalization) JavaScript applications. Introduction When creating an application that is going to be used by many people around the globe, it is important to remember that not everyone speak…
In this article, we'll look how to sort an Array in JavaScript, including the more advanced techniques of sorting a collection of records either ascending or descending on two or more fields. Basic Sorting of Arrays First, let's look at the …
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

785 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question