"go Back" Javascript

liunx

Guest
I'm using the below code to provide a handy alternative for returning to the previous page. It works fine in IE6, but doesn't do so well in Mozilla. For some reason I have to click my "Go Back" link twice to get it to go back. Any ideas out there as to why?<br /><br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1--><td height="68" colspan="2" align="left" valign="top"><br />      <a href=http://www.totalchoicehosting.com/forums/lofiversion/index.php/"#" onClick="history.go(-1);return true;" class="highlightText">Go Back!</a></td><!--c2--></div><!--ec2--><br /><br />Thanks<!--content-->
Tracy,<br /><br />Try this: <br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1--><a href=http://www.totalchoicehosting.com/forums/lofiversion/index.php/"JavaScript:history.go(-1);">Go Back</a><!--c2--></div><!--ec2--><br /><br />Jim<!--content-->
Awesome, Jim! Thanks a bunch!!<!--content-->
I'm having a similar problem with Mozilla Firebird. Slightly different. My detail page has a 'back' link (I've used both methods detailed above), and it works fine the first time. One click. If I go again to a detail page, either the same or a different one, the 'back' link fails, and continues to fail until I exit and restart the browser.<br /><br />I'm thinking this may be a bug in Firebird, but I thought I'd see if anybody has a better idea.<br /><br />Thanks in advance for any thoughts.<br />Jim<!--content-->
It does indeed sound a bug. Its a cheats way using javascript but its a good short cut<br /><br />Jim<!--content-->
<!--quoteo--><div class='quotetop'>QUOTE</div><div class='quotemain'><!--quotec-->Its a cheats way using javascript but its a good short cut<!--QuoteEnd--></div><!--QuoteEEnd--><br /><br />If using Javascript is a 'cheats way', what do you suggest as a better way? I know I could put a specific link to the previous page, but that would take the user back to the top of the page. By using a back link I send them back to the previous page at the place they left from.<!--content-->
<!--quoteo--><div class='quotetop'>QUOTE</div><div class='quotemain'><!--quotec-->If using Javascript is a 'cheats way', what do you suggest as a better way?<!--QuoteEnd--></div><!--QuoteEEnd--><br />Jim, I'd suggest you don't put anything at all. <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" /><br /><br />Every browser has a "back" button, so why waste your visitors' bandwidth and your account space with something everyone already has? <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/wink.gif" style="vertical-align:middle" emoid=";)" border="0" alt="wink.gif" /><!--content-->
Fair comment. Thanks. I'll see if the client agrees.<!--content-->
Another reason being that javascript can be turned off, and it also fails the recommedations layed out by W3C<br /><br />Jim<!--content-->
 
Top