469,332 Members | 6,612 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,332 developers. It's quick & easy.

Back button complicates ASP shopping cart item removal

Hi all,

I've built an online shopping cart using ASP Classic(based on a 'WebThang'
tutorial). The shop cart page (with table showing customers selected items
and costs) has only 3 buttons/links.

1: Back to Shop: Uses 'javascript:history.go(-1)' to go to previous page.

2: Remove Item(one next to each item in cart): Clears the selected item from
the session variable array redisplays the page.

3: Checkout: Proceeds nicely to the pages that collect the customers
details.

My Problem:

If the user clicks the 'Remove Item' link/button, the page efficiently
redisplays with the selected item removed from the list. However, if the
user then clicks either the 'Back to Shop' button or the browser Back button
(intending to continue shopping), the cart page redisplays showing the
removed item back in the list as it was before they removed it. Although the
session variable array remains correctly unaltered it is very confusing to
the user and will probably cause them to feel that their shopping list has
been 'messed up' and is now invalid.

I understand that the browser is just 'doing what it is told' but need to
find a way to avoid this confusing behaviour.

Any ideas,

Regards

Penny.
Jul 22 '05 #1
9 2117

"Penny" <pe***@spampolice.com> wrote in message
news:42******@funnel.arach.net.au...
Hi all,

I've built an online shopping cart using ASP Classic(based on a 'WebThang'
tutorial). The shop cart page (with table showing customers selected items
and costs) has only 3 buttons/links.

1: Back to Shop: Uses 'javascript:history.go(-1)' to go to previous page.

2: Remove Item(one next to each item in cart): Clears the selected item
from
the session variable array redisplays the page.

3: Checkout: Proceeds nicely to the pages that collect the customers
details.

My Problem:

If the user clicks the 'Remove Item' link/button, the page efficiently
redisplays with the selected item removed from the list. However, if the
user then clicks either the 'Back to Shop' button or the browser Back
button
(intending to continue shopping), the cart page redisplays showing the
removed item back in the list as it was before they removed it. Although
the
session variable array remains correctly unaltered it is very confusing to
the user and will probably cause them to feel that their shopping list has
been 'messed up' and is now invalid.

I understand that the browser is just 'doing what it is told' but need to
find a way to avoid this confusing behaviour.
If you use location.replace to navigate between pages, the old page gets
replaced in the history stack with the new page, giving you somewhat of an
opportunity to manage what's available to go back to.

-Mark
Any ideas,

Regards

Penny.

Jul 22 '05 #2
Hi Mark,

Do you have any snippets of code I could see to get a perspective on how
location.replace can be used?

Regards

Penny.
"Mark J. McGinty" <mm******@spamfromyou.com> wrote in message
news:ui**************@tk2msftngp13.phx.gbl...

If you use location.replace to navigate between pages, the old page gets
replaced in the history stack with the new page, giving you somewhat of an
opportunity to manage what's available to go back to.

-Mark

Jul 22 '05 #3
If you don't want the user be able to see previous pages (exactly as they
were previously) you could likely prevent caching :
http://support.microsoft.com/kb/234067/en-us

Let us know if it works...

Patrice

--

"Penny" <pe***@spampolice.com> a écrit dans le message de
news:42******@funnel.arach.net.au...
Hi all,

I've built an online shopping cart using ASP Classic(based on a 'WebThang'
tutorial). The shop cart page (with table showing customers selected items
and costs) has only 3 buttons/links.

1: Back to Shop: Uses 'javascript:history.go(-1)' to go to previous page.

2: Remove Item(one next to each item in cart): Clears the selected item from the session variable array redisplays the page.

3: Checkout: Proceeds nicely to the pages that collect the customers
details.

My Problem:

If the user clicks the 'Remove Item' link/button, the page efficiently
redisplays with the selected item removed from the list. However, if the
user then clicks either the 'Back to Shop' button or the browser Back button (intending to continue shopping), the cart page redisplays showing the
removed item back in the list as it was before they removed it. Although the session variable array remains correctly unaltered it is very confusing to
the user and will probably cause them to feel that their shopping list has
been 'messed up' and is now invalid.

I understand that the browser is just 'doing what it is told' but need to
find a way to avoid this confusing behaviour.

Any ideas,

Regards

Penny.

Jul 22 '05 #4
On Wed, 25 May 2005 19:49:08 +0800, "Penny" <pe***@spampolice.com>
wrote:
Do you have any snippets of code I could see to get a perspective on how
location.replace can be used?
It's a client-side Javascript so you may want to ask in a Javascript
group, but here's a reference page:

http://www.klaban.torun.pl/help/jsref/location.htm

Jeff


"Mark J. McGinty" <mm******@spamfromyou.com> wrote in message
news:ui**************@tk2msftngp13.phx.gbl...

If you use location.replace to navigate between pages, the old page gets
replaced in the history stack with the new page, giving you somewhat of an
opportunity to manage what's available to go back to.

-Mark


Jul 22 '05 #5
On Wed, 25 May 2005 11:46:49 +0800, "Penny" <pe***@spampolice.com>
wrote:
Hi all,

I've built an online shopping cart using ASP Classic(based on a 'WebThang'
tutorial). The shop cart page (with table showing customers selected items
and costs) has only 3 buttons/links.

1: Back to Shop: Uses 'javascript:history.go(-1)' to go to previous page.

2: Remove Item(one next to each item in cart): Clears the selected item from
the session variable array redisplays the page.

3: Checkout: Proceeds nicely to the pages that collect the customers
details.

My Problem:

If the user clicks the 'Remove Item' link/button, the page efficiently
redisplays with the selected item removed from the list. However, if the
user then clicks either the 'Back to Shop' button or the browser Back button
(intending to continue shopping), the cart page redisplays showing the
removed item back in the list as it was before they removed it. Although the
session variable array remains correctly unaltered it is very confusing to
the user and will probably cause them to feel that their shopping list has
been 'messed up' and is now invalid.

I understand that the browser is just 'doing what it is told' but need to
find a way to avoid this confusing behaviour.


I would think if you coded the shopping cart page to read the session
variables to populate the fileds and prevented caching on the page you
would see the result you want. Perhaps using a pragma:nocache header
would do it, you can use a meta tag for this:

<meta http-equiv="pragma" content="nocache">

There are other ways to disable page caching as well.

Jeff
Jul 22 '05 #6
Patrice,

It works in that it prevents previously removed items from the cart being
shown again but when expecting to be redirected back to the last 'shopping'
page it usually says 'Warning: Page has Expired'.

The suggested code:

<% Response.CacheControl = "no-cache" %>
<% Response.AddHeader "Pragma", "no-cache" %>
<% Response.Expires = -1 %>

Seems to prevent redirecting to whatever the previous page was. My catch is
that I want to return to the 'shop' page that directed to the 'cart' page in
the first place but not return to an old version of the 'cart' page itself.
Jul 22 '05 #7

Thanks Jeff,

I'll have a play with that and get back to you.
Jul 22 '05 #8
Jeff,

<meta http-equiv="pragma" content="nocache"> doesn't work either. It still
allows the page to redirect to the previous version of itself.

Penny.

I would think if you coded the shopping cart page to read the session
variables to populate the fileds and prevented caching on the page you
would see the result you want. Perhaps using a pragma:nocache header
would do it, you can use a meta tag for this:

<meta http-equiv="pragma" content="nocache">

There are other ways to disable page caching as well.

Jeff

Jul 22 '05 #9
Gazing into my crystal ball I observed "Penny" <pe***@spampolice.com>
writing in news:42******@funnel.arach.net.au:

I would think if you coded the shopping cart page to read the session
variables to populate the fileds and prevented caching on the page you
would see the result you want. Perhaps using a pragma:nocache header
would do it, you can use a meta tag for this:

<meta http-equiv="pragma" content="nocache">

There are other ways to disable page caching as well.

Jeff,

<meta http-equiv="pragma" content="nocache"> doesn't work either. It still
allows the page to redirect to the previous version of itself.

Penny.

IIRC the Meta element is controled by the browser and the browser can
disregard it. AFAIK you have to do it server side, eg:
Response.Expires = 60
Response.Expiresabsolute = Now() - 1
Response.AddHeader "pragma","no-cache"
Response.AddHeader "cache-control","private"
Response.CacheControl = "no-cache"

--
Adrienne Boswell
http://www.cavalcade-of-coding.info
Please respond to the group so others can share
Jul 22 '05 #10

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Amit Kela | last post: by
1 post views Thread by madison | last post: by
1 post views Thread by Paul Goodley | last post: by
1 post views Thread by Johan Nedin | last post: by
4 posts views Thread by Winshent | last post: by
1 post views Thread by Alex Allage | last post: by
10 posts views Thread by Martien van Wanrooij | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.