473,327 Members | 2,007 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,327 software developers and data experts.

IE doesn't preserve changes made by javascript when Back button is clicked

Hi,

In one of my pages, I use javascript (AJAX) to populate one mulitple
select field based on user's click event on another control. I noticed
that when I navigate back to this page by clicking browser's "Back"
button, the changes made to the multiple select is not preserved. (It
shows the initial value). While all the other user selections are
preserved.
Firefox seems fine.
How do I workaround this issue for IE?

Thanks!
Lucy

Mar 31 '07 #1
6 4284
On 31 Mar, 06:28, lucy...@gmail.com wrote:
Hi,

In one of my pages, I use javascript (AJAX) to populate one mulitple
select field based on user's click event on another control. I noticed
that when I navigate back to this page by clicking browser's "Back"
button, the changes made to the multiple select is not preserved. (It
shows the initial value). While all the other user selections are
preserved.
Firefox seems fine.
How do I workaround this issue for IE?

Thanks!
Lucy
You notice that in /your/ browsers (versions x on OS y) the field
values are preserved, this is not guaranteed behaviour for many
browsers.
If this page forms part of a multiple form, then clicking back could
weel be part of the "expected usage" for a user, otherwise I would say
once submitted, I don't mind if the values are not there.
You could use an onload to see if the user has set the preference for
the control that is preserved, and use that to populate the multiple
select. (if that is what you mean by initial value)
The alternative is to actually use server side code to force every
browser to be consistent by hard coding into the markup the (filtered
and validated) results of the submission the user made before clicking
back. This way whether they press back, or browse around suddenly to
other parts of the site without completely filling in the form, and
then decide to go back and carry on fillin gin the form, they will be
plesantly surprised.
Of course there are more cases that this, if the user isn't known to
you (not logged in) and their browser crashes, or if the user kills
the browser, then firefox might preserve the data if you are lucky
whereas ie won't, you can get round this by setting a cookie which
contains the values that have been filled so far, and that the server
hasn't told the user-agent to delete from the cookie yet, this should
be a temporary cookie. If your user is known to you, when they sign
back in after a crash, you could use the use the orphaned values from
their last session (if you code a bit of server logic) to allow them
to resume, again something to watch in terms of security, but it is
similar to "remember me" but with less scope and therefore less
surface area of attack.

Mar 31 '07 #2
On Mar 31, 6:30 am, "shimmyshack" <matt.fa...@gmail.comwrote:
On 31 Mar, 06:28, lucy...@gmail.com wrote:
Hi,
In one of my pages, I usejavascript(AJAX) to populate one mulitple
select field based on user's click event on another control. I noticed
that when I navigatebackto this page by clicking browser's "Back"
button, the changes made to the multiple select is not preserved. (It
shows the initial value). While all the other user selections are
preserved.
Firefox seems fine.
How do I workaround this issue for IE?
Thanks!
Lucy

You notice that in /your/ browsers (versions x on OS y) the field
values are preserved, this is not guaranteed behaviour for many
browsers.
If this page forms part of a multiple form, then clickingbackcould
weel be part of the "expected usage" for a user, otherwise I would say
once submitted, I don't mind if the values are not there.
You could use an onload to see if the user has set the preference for
the control that is preserved, and use that to populate the multiple
select. (if that is what you mean by initial value)
The alternative is to actually use server side code to force every
browser to be consistent by hard coding into the markup the (filtered
and validated) results of the submission the user made before clickingback. This way whether they pressback, or browse around suddenly to
other parts of the site without completely filling in the form, and
then decide to gobackand carry on fillin gin the form, they will be
plesantly surprised.
Of course there are more cases that this, if the user isn't known to
you (not logged in) and their browser crashes, or if the user kills
the browser, then firefox mightpreservethe data if you are lucky
whereas ie won't, you can get round this by setting a cookie which
contains the values that have been filled so far, and that the server
hasn't told the user-agent to delete from the cookie yet, this should
be a temporary cookie. If your user is known to you, when they signbackin after a crash, you could use the use the orphaned values from
their last session (if you code a bit of server logic) to allow them
to resume, again something to watch in terms of security, but it is
similar to "remember me" but with less scope and therefore less
surface area of attack.
Thanks for your response.
The problem is IE remembers the user's selection, but the
corresponding modification using javascript is lost. Which causes
mismatched information on my page.
For example, I have two dropdown lists. Based on user's selection on
dropdown#1, I search the database and populate dropdown#2. This works
fine until user navigate back to this page using "back" button. The
selection of dropdown#1 is preserved, but the content in dropdown#2 is
set back to the default values.
I tried to use server side script, but this makes the page extremely
complicated, which I thought this is a perfact place to use AJAX...

Apr 2 '07 #3
On 2 Apr, 02:02, lucy...@gmail.com wrote:
On Mar 31, 6:30 am, "shimmyshack" <matt.fa...@gmail.comwrote:
On 31 Mar, 06:28, lucy...@gmail.com wrote:
Hi,
In one of my pages, I usejavascript(AJAX) to populate one mulitple
select field based on user's click event on another control. I noticed
that when I navigatebackto this page by clicking browser's "Back"
button, the changes made to the multiple select is not preserved. (It
shows the initial value). While all the other user selections are
preserved.
Firefox seems fine.
How do I workaround this issue for IE?
Thanks!
Lucy
You notice that in /your/ browsers (versions x on OS y) the field
values are preserved, this is not guaranteed behaviour for many
browsers.
If this page forms part of a multiple form, then clickingbackcould
weel be part of the "expected usage" for a user, otherwise I would say
once submitted, I don't mind if the values are not there.
You could use an onload to see if the user has set the preference for
the control that is preserved, and use that to populate the multiple
select. (if that is what you mean by initial value)
The alternative is to actually use server side code to force every
browser to be consistent by hard coding into the markup the (filtered
and validated) results of the submission the user made before clickingback. This way whether they pressback, or browse around suddenly to
other parts of the site without completely filling in the form, and
then decide to gobackand carry on fillin gin the form, they will be
plesantly surprised.
Of course there are more cases that this, if the user isn't known to
you (not logged in) and their browser crashes, or if the user kills
the browser, then firefox mightpreservethe data if you are lucky
whereas ie won't, you can get round this by setting a cookie which
contains the values that have been filled so far, and that the server
hasn't told the user-agent to delete from the cookie yet, this should
be a temporary cookie. If your user is known to you, when they signbackin after a crash, you could use the use the orphaned values from
their last session (if you code a bit of server logic) to allow them
to resume, again something to watch in terms of security, but it is
similar to "remember me" but with less scope and therefore less
surface area of attack.

Thanks for your response.
The problem is IE remembers the user's selection, but the
corresponding modification using javascript is lost. Which causes
mismatched information on my page.
For example, I have two dropdown lists. Based on user's selection on
dropdown#1, I search the database and populate dropdown#2. This works
fine until user navigate back to this page using "back" button. The
selection of dropdown#1 is preserved, but the content in dropdown#2 is
set back to the default values.
I tried to use server side script, but this makes the page extremely
complicated, which I thought this is a perfact place to use AJAX...
so did you try the onload?

What you need to do is use server sessions to set the initial values
of the form fields when the page loads. The same ajax scripts, just
with an init method instead of assuming the user hasn't been before.
The server session simply puts its value in that javascript. 2 lines
of code, perhaps 1

Apr 2 '07 #4
Hi,

"shimmyshack" <ma********@gmail.comwrote in message
news:11**********************@e65g2000hsc.googlegr oups.com...
On 2 Apr, 02:02, lucy...@gmail.com wrote:
On Mar 31, 6:30 am, "shimmyshack" <matt.fa...@gmail.comwrote:
On 31 Mar, 06:28, lucy...@gmail.com wrote:
Hi,
In one of my pages, I usejavascript(AJAX) to populate one mulitple
select field based on user's click event on another control. I
noticed
that when I navigatebackto this page by clicking browser's "Back"
button, the changes made to the multiple select is not preserved.
(It
shows the initial value). While all the other user selections are
preserved.
Firefox seems fine.
How do I workaround this issue for IE?
Thanks!
Lucy
You notice that in /your/ browsers (versions x on OS y) the field
values are preserved, this is not guaranteed behaviour for many
browsers.
If this page forms part of a multiple form, then clickingbackcould
weel be part of the "expected usage" for a user, otherwise I would say
once submitted, I don't mind if the values are not there.
You could use an onload to see if the user has set the preference for
the control that is preserved, and use that to populate the multiple
select. (if that is what you mean by initial value)
The alternative is to actually use server side code to force every
browser to be consistent by hard coding into the markup the (filtered
and validated) results of the submission the user made before
clickingback. This way whether they pressback, or browse around suddenly to
other parts of the site without completely filling in the form, and
then decide to gobackand carry on fillin gin the form, they will be
plesantly surprised.
Of course there are more cases that this, if the user isn't known to
you (not logged in) and their browser crashes, or if the user kills
the browser, then firefox mightpreservethe data if you are lucky
whereas ie won't, you can get round this by setting a cookie which
contains the values that have been filled so far, and that the server
hasn't told the user-agent to delete from the cookie yet, this should
be a temporary cookie. If your user is known to you, when they
signbackin after a crash, you could use the use the orphaned values from
their last session (if you code a bit of server logic) to allow them
to resume, again something to watch in terms of security, but it is
similar to "remember me" but with less scope and therefore less
surface area of attack.
Thanks for your response.
The problem is IE remembers the user's selection, but the
corresponding modification using javascript is lost. Which causes
mismatched information on my page.
For example, I have two dropdown lists. Based on user's selection on
dropdown#1, I search the database and populate dropdown#2. This works
fine until user navigate back to this page using "back" button. The
selection of dropdown#1 is preserved, but the content in dropdown#2 is
set back to the default values.
I tried to use server side script, but this makes the page extremely
complicated, which I thought this is a perfact place to use AJAX...

so did you try the onload?

What you need to do is use server sessions to set the initial values
of the form fields when the page loads. The same ajax scripts, just
with an init method instead of assuming the user hasn't been before.
The server session simply puts its value in that javascript. 2 lines
of code, perhaps 1
FWIW, if you use Frames, when you "go back" (hide the second frame and make
the first frame visible again) all is as you left it, or as page 2's
javascript modified it, as the case may be.

Cheers Richard Maher
Apr 2 '07 #5
On Apr 2, 10:53 am, "Richard Maher" <maher...@hotspamnotmail.com>
wrote:
Hi,

"shimmyshack" <matt.fa...@gmail.comwrote in message

news:11**********************@e65g2000hsc.googlegr oups.com...
On 2 Apr, 02:02, lucy...@gmail.com wrote:
On Mar 31, 6:30 am, "shimmyshack" <matt.fa...@gmail.comwrote:
On 31 Mar, 06:28, lucy...@gmail.com wrote:
Hi,
In one of my pages, I usejavascript(AJAX) to populate one mulitple
select field based on user's click event on another control. I
noticed
that when I navigatebackto this page by clicking browser's "Back"
button, the changes made to the multiple select is not preserved.
(It
shows the initial value). While all the other user selections are
preserved.
Firefox seems fine.
How do I workaround this issue for IE?
Thanks!
Lucy
You notice that in /your/ browsers (versions x on OS y) the field
values are preserved, this is not guaranteed behaviour for many
browsers.
If this page forms part of a multiple form, then clickingbackcould
weel be part of the "expected usage" for a user, otherwise I would say
once submitted, I don't mind if the values are not there.
You could use an onload to see if the user has set the preference for
the control that is preserved, and use that to populate the multiple
select. (if that is what you mean by initial value)
The alternative is to actually use server side code to force every
browser to be consistent by hard coding into the markup the (filtered
and validated) results of the submission the user made before

clickingback. This way whether they pressback, or browse around suddenly to other parts of the site without completely filling in the form, and
then decide to gobackand carry on fillin gin the form, they will be
plesantly surprised.
Of course there are more cases that this, if the user isn't known to
you (not logged in) and their browser crashes, or if the user kills
the browser, then firefox mightpreservethe data if you are lucky
whereas ie won't, you can get round this by setting a cookie which
contains the values that have been filled so far, and that the server
hasn't told the user-agent to delete from the cookie yet, this should
be a temporary cookie. If your user is known to you, when they

signbackin after a crash, you could use the use the orphaned values from
their last session (if you code a bit of server logic) to allow them
to resume, again something to watch in terms of security, but it is
similar to "remember me" but with less scope and therefore less
surface area of attack.
Thanks for your response.
The problem is IE remembers the user's selection, but the
corresponding modification using javascript is lost. Which causes
mismatched information on my page.
For example, I have two dropdown lists. Based on user's selection on
dropdown#1, I search the database and populate dropdown#2. This works
fine until user navigate back to this page using "back" button. The
selection of dropdown#1 is preserved, but the content in dropdown#2 is
set back to the default values.
I tried to use server side script, but this makes the page extremely
complicated, which I thought this is a perfact place to use AJAX...
so did you try the onload?
What you need to do is use server sessions to set the initial values
of the form fields when the page loads. The same ajax scripts, just
with an init method instead of assuming the user hasn't been before.
The server session simply puts its value in that javascript. 2 lines
of code, perhaps 1

FWIW, if you use Frames, when you "go back" (hide the second frame and make
the first frame visible again) all is as you left it, or as page 2's
javascript modified it, as the case may be.

Cheers Richard Maher
Or IFRAME since you don't need to change the overall layou of your
page.

Regards,
Hardono Arifanto
-----------------------
http://sodeve.net

Apr 2 '07 #6
On Apr 2, 3:33 am, "Hardono Arifanto" <hard...@gmail.comwrote:
On Apr 2, 10:53 am, "Richard Maher" <maher...@hotspamnotmail.com>
wrote:


Hi,
"shimmyshack" <matt.fa...@gmail.comwrote in message
news:11**********************@e65g2000hsc.googlegr oups.com...
On 2 Apr, 02:02, lucy...@gmail.com wrote:
On Mar 31, 6:30 am, "shimmyshack" <matt.fa...@gmail.comwrote:
On 31 Mar, 06:28, lucy...@gmail.com wrote:
Hi,
In one of my pages, I usejavascript(AJAX) to populate one mulitple
select field based on user's click event on another control. I
noticed
that when I navigatebackto this page by clicking browser's "Back"
button, the changes made to the multiple select is not preserved.
(It
shows the initial value). While all the other user selections are
preserved.
Firefox seems fine.
How do I workaround this issue for IE?
Thanks!
Lucy
You notice that in /your/ browsers (versions x on OS y) the field
values are preserved, this is not guaranteed behaviour for many
browsers.
If this page forms part of a multiple form, then clickingbackcould
weel be part of the "expected usage" for a user, otherwise I would say
once submitted, I don't mind if the values are not there.
You could use an onload to see if the user has set the preference for
the control that is preserved, and use that to populate the multiple
select. (if that is what you mean by initial value)
The alternative is to actually use server side code to force every
browser to be consistent by hard coding into the markup the (filtered
and validated) results of the submission the user made before
clickingback. This way whether they pressback, or browse around suddenly to other parts of the site without completely filling in the form, and
then decide to gobackand carry on fillin gin the form, they will be
plesantly surprised.
Of course there are more cases that this, if the user isn't known to
you (not logged in) and their browser crashes, or if the user kills
the browser, then firefox mightpreservethe data if you are lucky
whereas ie won't, you can get round this by setting a cookie which
contains the values that have been filled so far, and that the server
hasn't told the user-agent to delete from the cookie yet, this should
be a temporary cookie. If your user is known to you, when they
signbackin after a crash, you could use the use the orphaned values from
their last session (if you code a bit of server logic) to allow them
to resume, again something to watch in terms of security, but it is
similar to "remember me" but with less scope and therefore less
surface area of attack.
Thanks for your response.
The problem is IE remembers the user's selection, but the
corresponding modification using javascript is lost. Which causes
mismatched information on my page.
For example, I have two dropdown lists. Based on user's selection on
dropdown#1, I search the database and populate dropdown#2. This works
fine until user navigatebackto this page using "back" button. The
selection of dropdown#1 is preserved, but the content in dropdown#2 is
setbackto the default values.
I tried to use server side script, but this makes the page extremely
complicated, which I thought this is a perfact place to use AJAX...
so did you try the onload?
What you need to do is use server sessions to set the initial values
of the form fields when the page loads. The same ajax scripts, just
with an init method instead of assuming the user hasn't been before.
The server session simply puts its value in that javascript. 2 lines
of code, perhaps 1
FWIW, if you use Frames, when you "goback" (hide the second frame and make
the first frame visible again) all is as you left it, or as page 2's
javascript modified it, as the case may be.
Cheers Richard Maher

Or IFRAME since you don't need to change the overall layou of your
page.

Regards,
Hardono Arifanto
-----------------------http://sodeve.net- Hide quoted text -

- Show quoted text -
Great! Thanks all for the response.

Apr 5 '07 #7

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

Similar topics

16
by: Dave Smithz | last post by:
Hi, In summary: I want to a form to submit information via a HTTP POST, however, when using Internet Explorer I want to be able to use the back button and all the information retained....
5
by: B.r.K.o.N.j.A. | last post by:
I've made a script for managing shoppingcart (something like cart.php?action=add&item=12345) and it works fine, the problem is: when user hits the back button page after he added something in the...
12
by: Javier | last post by:
Hello, I'm very new in this forum and as I have the following problem, the website is in http://new.vanara.com ----------------------------------------------------------------------------...
8
by: Galina | last post by:
Hello I have 6 dependent list boxes on my ASP page:  Faculty;  Lecturer;  Course;  Course occurrence;  Group;  Week commencing date. When faculty is selected, lists of lecturers and...
2
by: Dot net work | last post by:
Hello. I have an aspx page that changes an HTML label's text using javascript. After the label's text has been changed in this way, I redirect to another aspx page. If I then use the back...
7
by: Sridhar | last post by:
Hi, I have a question regarding the Page_Load method and Back Button of Internet explorer. I have created a webform. In that webform I have several Text Boxes. Also I have two buttons. When I...
1
by: rharmonster | last post by:
I have an asp page that builds a calendar made up of images for each day. When a user selects a day, javascript changes the day selected and the next 2 days' images to a "booked" image. I place...
12
by: GaryDean | last post by:
After a lot of Google research, there doesn't appear to be a easy solution for detecting or preventing a user of an asp.net application from using the backbutton. Is there any way to deal with...
8
by: Harvey Schmidlapp | last post by:
I have a fairly complex form (generated by means of an ASP 3 page). The form is used to define a query against a database. After running a query, the user hits their browser's back button and goes...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.