Solved

javascript:history.back() problem with Netscape Frames

Posted on 1997-12-19
10
498 Views
Last Modified: 2008-02-01
I've experienced a problem when using the javascript:history.back() construct on a site employing Frames and viewed by a Netscape client.  It works fine with MSIE 4.0 but with Netscape, it appears to do something (no errors) but don't perform the back function.  

Is there anyone out here that can offer a suggestion for how to make this function work (or one like it) work for both major browser client software products?

I have tried the javascript:history.go(-1) construct and that didn't work either.  

For whatever reason, as I noted above, back() works 100% of the time with MSIE 4.0 and never with Netscape's browser (4.0n).

Thanks in advance for your assistance.
0
Comment
Question by:netbest
  • 5
  • 4
10 Comments
 
LVL 2

Expert Comment

by:rigansen
ID: 1277034
I don't work with IE, but you must know that the history array saves one entry for every frame that is loaded so if you load a page with frames and expect to go back using history.go(..), think that history.go(-1) will work?? well, you're wrong... you'll have to use maybe history.go(-2) or history.go(-3), depending on the number of frames you're working with!!

good luck on this one!!

rigansen.
0
 

Author Comment

by:netbest
ID: 1277035
Edited text of question
0
 
LVL 6

Accepted Solution

by:
tecbuilder earned 100 total points
ID: 1277036
The problem is that you are using the history list of the parent and not of the frame and how the history list works with frames.  Instead of history.go(-1) use parent.mainframe.history.go(-1).  Also instead of history.go(1) use parent.mainframe.history.go(1).  Another option is to ue the history.back() or history.forward() functions.

Let me know how this works out for your.
0
 

Author Comment

by:netbest
ID: 1277037
Ive tried as tecbuilder suggested without success.  The use of javascript:parent.mainframe.history.go(-1) causes an error (parent.mainframe.history is not an object).  I'm not versed on javascript but, is there a possibility that I have to set some other parameter?
0
 
LVL 6

Expert Comment

by:tecbuilder
ID: 1277038
Did you substitute the word 'mainframe' with your frame's name?  If not do this.
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Author Comment

by:netbest
ID: 1277039
Just so I don't go off into another wierd loop..  The need is to take the user back to whatever location they came from.  If it was from within the site, fine... if not, it needs to take them back to where ever then came from.  Will the parent.<framename> do this?
0
 
LVL 6

Expert Comment

by:tecbuilder
ID: 1277040
Only if they went somewhere from within the frame.  Did you try using the history.back() and history.forward() functions?  These you would use the same way as you were using the history.go(-1) and history.go(1) functions respectively.
0
 
LVL 6

Expert Comment

by:tecbuilder
ID: 1277041
Only if they went somewhere from within the frame.  Did you try using the history.back() and history.forward() functions?  These you would use the same way as you were using the history.go(-1) and history.go(1) functions respectively and may work better for what you want.
0
 

Author Comment

by:netbest
ID: 1277042
I've tried parent.history.back(), history.back(), parent.history.main.back() and the same optioins with go(-1).  When I use the parent.history.back() Netscape and MSIE both send me to the first page behind the site.. even if I've been navigating within the site.

The only thing that works like I want it to (MSIE ONLY)is the javascript.history.back().  It don't seem to care whether it is in a frame or not.  It just takes me back one space in common history.  Netscape thinks it did something (4.04 by the way) but it don't load the previous page.  This sure has become more complecated that I'd hoped it would.
0
 
LVL 6

Expert Comment

by:tecbuilder
ID: 1277043
The information I've given you is all that I know and found.  The only other things left is document.history.back() or self.history.bac().  Otherwise, it may just be a bug within Netscape.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

This article shows how to create and access 2-dimensional arrays in JavaScript.  It includes a tutorial in case you are just trying to "get your head wrapped around" the concept and we'll also look at some useful tips for more advanced programmers. …
JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
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…

746 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

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now