473,405 Members | 2,310 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Nasty Firefox problem with history.back()

Hi all

I have a history.back() problem with FF(2). IE works as expected, while FF
does not. The multi frame website setup as a whole with a lot of frame
content switching works flawlessly in both browsers. In one situation and
frame I have a long scrollable list of cars offered for sale. Some list
lines are linked to a separate page with images, to be loaded into the
same frame as the listing.

On closing this image page with <a href="javascript:history.back();">
Button.gif</a>, the listing reappears, maintaining the former vertical
position and showing the corresponding line in the same place where the
visitor started from (as opposed to the listing reverting to the top).
This appears to the visitor as a sleek operation and I think is essential.

Now, some cars have 2 or more images, implemented as rollover with <a
href="#" onClick= "change();">Close.gif</a- and with this, the problem
starts.

This are the two involved functions:

var b1, b2, b3
function LoadImages() { // onLoad
b2 = new Image(); b2.src = "image_2.jpg";
b3 = new Image(); b3.src = "image_3.jpg";
b1 = new Image(); b1.src = "image_1.jpg";
}
var n = 3
var i = 1
function change() {
i = i + 1;
if (i == (n+1)) i = 1;
img = "b" + i + ".src";
document.placeholder.src = eval(img); return false
}

In IE, this works consistently with one only or more images. In FF
however, the return history.back() shows a peculiar attitude. With single
image pages or multi image pages - but without actuating the rollover - FF
returns as expected with a single click. But after actuating the rollover,
FF requires a double click. As this is inconsistent and wholly unexpected,
it appears to the visitor as a bug and as "does not work properly".

For days I trial-and-errored a work-around, but to no avail, even with
separate code using navigator.appName. It has nothing to do with focus, as
moving focus around with (Shift)/Tab has no influence. My code appears to
me as straight forward and without any apparent interference between
change and close. The peculiar FF behaviour applies even to the original
back button of FF itself. So it looks like some kind of "lock in the FF
engine" - if possible at all.

I don't mind supplying more code and url, if you find it useful. But for
now I would like to ask for a first opinion - and probably even snag and
work-around are known to professionals (which I'm not).

Very many thanks for your consideration and possible help.
Heinrich Wolf
May 28 '07 #1
4 10079
On Mon, 28 May 2007 19:21:23 +0200, Heinrich Wolf
<XX************@hispeed.chwrote:
Hi all

I have a history.back() problem with FF(2). IE works as expected, while
FF does not. The multi frame website setup as a whole with a lot of
frame content switching works flawlessly in both browsers. In one
situation and frame I have a long scrollable list of cars offered for
sale. Some list lines are linked to a separate page with images, to be
loaded into the same frame as the listing.

On closing this image page with <a href="javascript:history.back();"
Button.gif</a>, the listing reappears, maintaining the former vertical
position and showing the corresponding line in the same place where the
visitor started from (as opposed to the listing reverting to the top).
This appears to the visitor as a sleek operation and I think is
essential.

Now, some cars have 2 or more images, implemented as rollover with <a
href="#" onClick= "change();">Close.gif</a- and with this, the problem
starts.

This are the two involved functions:

var b1, b2, b3
function LoadImages() { // onLoad
b2 = new Image(); b2.src = "image_2.jpg";
b3 = new Image(); b3.src = "image_3.jpg";
b1 = new Image(); b1.src = "image_1.jpg";
}
var n = 3
var i = 1
function change() {
i = i + 1;
if (i == (n+1)) i = 1;
img = "b" + i + ".src";
document.placeholder.src = eval(img); return false
}

In IE, this works consistently with one only or more images. In FF
however, the return history.back() shows a peculiar attitude. With
single image pages or multi image pages - but without actuating the
rollover - FF returns as expected with a single click. But after
actuating the rollover, FF requires a double click. As this is
inconsistent and wholly unexpected, it appears to the visitor as a bug
and as "does not work properly".

For days I trial-and-errored a work-around, but to no avail, even with
separate code using navigator.appName. It has nothing to do with focus,
as moving focus around with (Shift)/Tab has no influence. My code
appears to me as straight forward and without any apparent interference
between change and close. The peculiar FF behaviour applies even to the
original back button of FF itself. So it looks like some kind of "lock
in the FF engine" - if possible at all.

I don't mind supplying more code and url, if you find it useful. But for
now I would like to ask for a first opinion - and probably even snag and
work-around are known to professionals (which I'm not).

Very many thanks for your consideration and possible help.
Heinrich Wolf
I think you problem is best solved with history.go(-1);

--
There are 10 kinds of people:
those who know binary, and the others ...
May 29 '07 #2
Kristin Bruun wrote:
On Mon, 28 May 2007 19:21:23 +0200, Heinrich Wolf
<XX************@hispeed.chwrote:
>I have a history.back() problem with FF(2).
[skipped]
I think your problem is best solved with history.go(-1);
Unfortunately not, it behaves the same as history:back(). Actually, it
appears not as a Javascript issue, but Firefox. As mentioned before, the
"lock" applies even to the back button of Firefox itself and is entirely
independent of the history coding - if anything is realated to the
rollover code supplied.

But this rollover code appears as most straight forward, works well and to
me provides absolutely no hint about any flaws??

Might be appropriate to post in FF forums, but since it shows as a clear
non-performance of Javascript, I thought the issue might be known to Js
people and therefore chose to post here.

Any more ideas?
Thanks - HW

May 29 '07 #3
On May 28, 6:21 pm, Heinrich Wolf <XXXXh.wolfX...@hispeed.chwrote:
On closing this image page with
<a href="javascript:history.back();">
Button.gif</a>
Now, some cars have 2 or more images,
implemented as rollover with <a
href="#" onClick= "change();">Close.gif</a-
and with this, the problem
starts.

With single image pages or multi image pages
- but without actuating the rollover - FF
returns as expected with a single click.
But after actuating the rollover,
FF requires a double click.
Of course it does - clicking your close.gif
causes the browser to call change(); and then
navigate to an un-named anchor in the same
page, because you've got href="#" in there.

So you need two back's to go back to the right
page in the history.

Rewrite the way you call your javascript and
all will be well. Either attach the call
directly to the onclick of the images, or
use this quick hack version:

<a href="#" onClick= "change();return false;">Close.gif</a>

[Yes there are _better_ ways of doing this, but
this solves his immediate problem].

That your page is ONLY usable to those with
javascript, but no doubt you will encounter
THAT little problem later...

May 29 '07 #4
ne**@chthonic.f9.co.uk schrieb:
On May 28, 6:21 pm, Heinrich Wolf <XXXXh.wolfX...@hispeed.chwrote:
>On closing this image page with
<a href="javascript:history.back();">Button.gif</a>
>Now, some cars have 2 or more images,
implemented as rollover with
<a href="#" onClick= "change();">Close.gif</a-
and with this, the problem starts.

With single image pages or multi image pages
- but without actuating the rollover - FF
returns as expected with a single click.
But after actuating the rollover,
FF requires a double click.
Very many thanks for your helpful answer.
It gives me a lot to chew on...
Please allow some questions - not to question your
statements, but to get a clearer picture, if possible.
Of course it does - clicking your close.gif
causes the browser to call change(); and then
navigate to an un-named anchor in the same
page, because you've got href="#" in there.

So you need two back's to go back to the right
page in the history.

Rewrite the way you call your javascript and
all will be well. Either attach the call
directly to the onclick of the images, or
use this quick hack version:

<a href="#" onClick= "change();return false;">Close.gif</a>
I think I understand what you say, but why does the
"return false" at the end of function change() not
serve the same purpose?
[Yes there are _better_ ways of doing this, but
this solves his immediate problem].
Yes it does, and I'm most grateful for this.

I too tried to put the onClick into the image line:
<img onClick="change();return false;" name="placeholder" src="...
and it works well too - as you say.

Would you mind commenting any further on "better ways"?
That your page is ONLY usable to those with
javascript, but no doubt you will encounter
THAT little problem later...
I tested my project (only now) with js switched off and the
only real problem are the many rollovers. Would you please
indicate how to modify my js code?

I read somewhere to put an url in place of the # in
<a href="#" onClick="change();return false;">
Would that mean to load a complete new page for
each successive image? Would that be the proper way
to simulate a rollover without js?
One final question: would you know a recent book
on issues involved here? I know of www.w3.org and
google for js - but as usual, try to find the needle
in the haystack of statements. What would be helpful
is a clever book to set a frame of today's js use.
Very many thanks again!
Heinrich Wolf
May 30 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Justin | last post by:
Hi, I have a simple frameset defined: ---------------- index.html ---------------- <FRAMESET COLS = "225,*"> <FRAME NAME = "a" SRC = "one.html"> <FRAME NAME = "b" SRC = "one.html">...
1
by: DarthOptimus | last post by:
Hi, There is javascript code on my jsp to prevent double submission of a form: <SCRIPT type="text/javascript" language="JavaScript"> var firstSubmit = true; function isFirstSubmit() {
3
by: Olaf Rabbachin | last post by:
Hi *, ich erzeuge zur Laufzeit in einer ASP-Tabelle Tabellenzellen. Im Großteil dieser Zellen befinden sich Checkboxes. Per JS ändere ich beim Click auf eine solche Zelle oder deren Checkbox die...
9
by: vighnesh | last post by:
Hi Folks Greetings to you all. I have been dealing a project, in which one of the requirement is to clear FireFox browser history programatically. Can anybody suggest me, how this can be...
7
by: mohammed.naghman | last post by:
Hi, I have 2 submit buttons in a jsp page. One of them takes me to page2.jsp and also passes the values enetered to page2.I have a link in the page2 that does a history.back to come to the...
1
by: bsonline | last post by:
I want to use history.back(-1) and refresh the page at same time .. like with history.back(-1) event when the destination page is displayed at that it also be refreshed. is this possible ?
2
by: Max | last post by:
I recently moved to ASPnet Ext 3.5 What I can't get with Ajax and History browser managemet is this: User fills some fields (dropdown and textbox) on page 1 (all are in an update panel) User...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.