Connecting Tech Pros Worldwide Forums | Help | Site Map

When user clicks BACK, force refresh and auto scroll.

Badass Scotsman
Guest
 
Posts: n/a
#1: Apr 26 '06
Hello,

I have an application which should never allow the back button to be pushed
without refreshing the previous page. For example:

Step 1:
User fills in form.html and presses submit

Step 2:
User see's results.html and clicks back to amend form

Step 3:
form.html MUST REFRESH ONCE and only once, which will do a few things on my
server before reloading the page.

Step 4:
After refresh, the page should SCROLL to the top of the page automatically

Pseudo Style:

If window.history.forward(1) exists
then
refresh this page and scroll to top
else
do nothing

I wonder if the following script can be modified to achieve my goal:

<script language="JavaScript"><!--
javascript:window.history.forward(1);
//--></script>

Any help greatly appreciated.

Badass.



Randy Webb
Guest
 
Posts: n/a
#2: Apr 27 '06

re: When user clicks BACK, force refresh and auto scroll.


Badass Scotsman said the following on 4/26/2006 10:37 AM:[color=blue]
> Hello,
>
> I have an application which should never allow the back button to be pushed
> without refreshing the previous page. For example:[/color]

Then your application is broken.
[color=blue]
> Step 1:
> User fills in form.html and presses submit
>
> Step 2:
> User see's results.html and clicks back to amend form
>
> Step 3:
> form.html MUST REFRESH ONCE and only once, which will do a few things on my
> server before reloading the page.[/color]

Set a cookie.
[color=blue]
> Step 4:
> After refresh, the page should SCROLL to the top of the page automatically[/color]

Ummm, set the hash property of the location then.
[color=blue]
> Pseudo Style:
>
> If window.history.forward(1) exists
> then
> refresh this page and scroll to top
> else
> do nothing[/color]

First, nothing in my History trail (if anything) is relevant or accessible.

Second. If I view your form and click a Favorites and navigate away
(without submitting the form), then click the Back button, your server
is gonna be hosed.
[color=blue]
> I wonder if the following script can be modified to achieve my goal:
>
> <script language="JavaScript"><!--
> javascript:window.history.forward(1);
> //--></script>[/color]

Modified or scratched and start over?

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Closed Thread