Problem with Javascript Back Button in Firefox

This is a discussion on "Problem with Javascript Back Button in Firefox" within the JavaScript Forum section. This forum, and the thread "Problem with Javascript Back Button in Firefox are both part of the Program Your Website category.



Go Back   Webforumz.com > Main Forums > Program Your Website > JavaScript Forum

Notices


Reply
 
LinkBack (1) Thread Tools
  1 links from elsewhere to this Post. Click to view. #1 (permalink)  
Old Jan 16th, 2006, 21:06
New Member
Join Date: Jan 2006
Age: 22
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Problem with Javascript Back Button in Firefox

'ello all.

I'm having trouble getting a javascript back button to work in Firefox.
Here's my script...
<form>
<p><a href="#" onClick="history.go(-1)"><img src="images/photos/Aug7Inferis001.jpg" width="640" height="480" border="1" color="white"> </p>
<img src="images/back.jpg" border=0</a>
</form>


The situation is this... normally this would work in firefox (methinks). However, my site opens in a javascript popup window... and for some reason the back button takes me back for a split second, but does not stay at the desired page.

That may be hard to follow... the best way I can explain it is by showing the site in action.
http://home.pct.edu/~sheros54/tbp
If you click on the "live band photography" section, click on one of the bands, then click on a picture you'll get to the page with the back button.

This works fine in IE.
Reply With Quote

  #2 (permalink)  
Old Jan 16th, 2006, 23:05
Highly Reputable Member
Join Date: May 2005
Location: U.K
Age: 21
Posts: 739
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to benbramz
Re: Problem with Javascript Back Button in Firefox

i tested it out in forefox and it worked fine...

do you have javascript turned of for some reason?
Reply With Quote
  #3 (permalink)  
Old Jan 16th, 2006, 23:16
New Member
Join Date: Jan 2006
Age: 22
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Problem with Javascript Back Button in Firefox

Haha, I kind of cheated. I dropped the whole back button idea and just linked each individual page back its gallery page.

<a href="inferis.html"><img src="images/photos/Aug7Inferis001.jpg"><img src="images/back.jpg" border=0</a>


Although, now when I look back on it I realize I have some conflicting code due to linking the images to the thumbnails that might have caused the problem. Not exactly positive that that is the problem, but at least it works now.
Reply With Quote
  #4 (permalink)  
Old Jan 16th, 2006, 23:38
Highly Reputable Member
Join Date: May 2005
Location: U.K
Age: 21
Posts: 739
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to benbramz
Re: Problem with Javascript Back Button in Firefox

when it works, its allways good
Reply With Quote
  #5 (permalink)  
Old Jun 25th, 2007, 22:23
New Member
Join Date: Jun 2007
Location: UK
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Problem with Javascript Back Button in Firefox

Ok, I know this post is old, but I thought I can help a few people by bringing a solution to the table. It's simple as well, infact so simple you wouldn't think of it.

The problem arises when you have the href="#". Firefox is listening to both the javascript to go back, and also the link to "#" on the page, so it does them in order. First it goes back, then it goes forward again to find the "#" on the page where the problem lies.

So the solution?

<a href="javascript:history.back();">back</a>

Simply link direct to the javascript, and lose the rest of it...
Reply With Quote
Reply

Tags
problem, javascript, button, firefox

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

LinkBacks (?)
LinkBack to this Thread: http://www.webforumz.com/javascript-forum/4877-problem-with-javascript-back-button-in.htm
Posted By For Type Date
::The Music Made Me Do It : Forum : General Discussion : Firefox hates me. This thread Refback Feb 14th, 2008 06:33

Similar Threads
Thread Thread Starter Forum Replies Last Post
opera, back button & javascript interval paza JavaScript Forum 4 May 23rd, 2008 21:19
Trouble with iframe and back button Zonglars JavaScript Forum 0 Jan 10th, 2008 13:27
Javascript Onmouseover problem with Firefox by Keniki Keniki JavaScript Forum 0 Mar 21st, 2007 22:50
Firefox Javascript problem Darkink JavaScript Forum 9 Feb 6th, 2007 22:20
Problem aligning submit button in Firefox AdRock Web Page Design 3 Aug 16th, 2006 10:13


All times are GMT. The time now is 22:33.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43