473,554 Members | 3,220 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 4306
On 31 Mar, 06:28, lucy...@gmail.c om 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, "shimmyshac k" <matt.fa...@gma il.comwrote:
On 31 Mar, 06:28, lucy...@gmail.c om wrote:
Hi,
In one of my pages, I usejavascript(A JAX) 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 clickingbackcou ld
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 mightpreserveth e 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.c om wrote:
On Mar 31, 6:30 am, "shimmyshac k" <matt.fa...@gma il.comwrote:
On 31 Mar, 06:28, lucy...@gmail.c om wrote:
Hi,
In one of my pages, I usejavascript(A JAX) 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 clickingbackcou ld
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 mightpreserveth e 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,

"shimmyshac k" <ma********@gma il.comwrote in message
news:11******** **************@ e65g2000hsc.goo glegroups.com.. .
On 2 Apr, 02:02, lucy...@gmail.c om wrote:
On Mar 31, 6:30 am, "shimmyshac k" <matt.fa...@gma il.comwrote:
On 31 Mar, 06:28, lucy...@gmail.c om wrote:
Hi,
In one of my pages, I usejavascript(A JAX) 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 clickingbackcou ld
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 mightpreserveth e 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...@hotsp amnotmail.com>
wrote:
Hi,

"shimmyshac k" <matt.fa...@gma il.comwrote in message

news:11******** **************@ e65g2000hsc.goo glegroups.com.. .
On 2 Apr, 02:02, lucy...@gmail.c om wrote:
On Mar 31, 6:30 am, "shimmyshac k" <matt.fa...@gma il.comwrote:
On 31 Mar, 06:28, lucy...@gmail.c om wrote:
Hi,
In one of my pages, I usejavascript(A JAX) 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 clickingbackcou ld
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 mightpreserveth e 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...@hotsp amnotmail.com>
wrote:


Hi,
"shimmyshac k" <matt.fa...@gma il.comwrote in message
news:11******** **************@ e65g2000hsc.goo glegroups.com.. .
On 2 Apr, 02:02, lucy...@gmail.c om wrote:
On Mar 31, 6:30 am, "shimmyshac k" <matt.fa...@gma il.comwrote:
On 31 Mar, 06:28, lucy...@gmail.c om wrote:
Hi,
In one of my pages, I usejavascript(A JAX) 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 clickingbackcou ld
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 mightpreserveth e 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
15723
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. Presently we get a "Page has expired" message. How can we avoid this? Full details: Having searched for postings on how to avoid the "Page has Expired"...
5
2472
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 cart, the add cart script is rerun and he ends up with having 2 of the same item. Is there a way to prevent script from running when accessed via...
12
9760
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 ---------------------------------------------------------------------------- -------------------------------------------- Here's how the site works: You should press a button in the rollover area in order to load a source file on...
8
2548
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 courses are populated. When course is selected, lists of occurrences, groups and
2
587
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 button on the browser, the label has lost it's newly changed value.
7
2471
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 click on button1, it populates the text boxes with person1 details. When I click on button2, it populates the text box with person2 details and...
1
1808
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 the day's value into a hidden form variable, so that when the user bounces around different months (same page), then comes back to the month with a...
12
2880
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 this problem? -- Regards, Gary Blakely
8
4735
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 back to the form, where their selections show up. They can change whatever they want to change and resubmit the new query. Mostly, everything works...
0
7589
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7787
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8029
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7551
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7881
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6131
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5428
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3550
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1121
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.