Detecting if the back button was used

I need to be able to detect in IE if the back button was used.  I am currently using javascript with perl as the backend.  I need to do this because my form is javascript created and creates a mess when the back button is used.  I would optimatly like to be able to refresh the form when the back button is used.

Thanks for all your help, the anser to this question seems to have been answered before but I am hoping that there is a more updated answer.  This is also an urgent matter

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Hi Ralph,

Try using the referrer property.  See this:

Check if the referrer to your form page contains the url of your results page.  If it does, then you came from 'the wrong direction' and need to refresh the form.

I hope this makes sense.

Peace and joy.  mvan
HonorGodSoftware EngineerCommented:
Unfortunately, I don't think that this will work.

According to the "World Wide Web Consortium (W3C) Document Object Model (DOM) Level 1":

Source URL =

referrer of type DOMString, readonly
               Returns the URI of the page that linked to this page. The
               value is an empty string if the user navigated to the page
               directly (not through a link, but, for example, via a

A slightly more detailed explaination can be found at
This property returns a value only when the user reaches the
current page through a link from the previous page.
Otherwise, document.referrer returns an empty string;
it also returns an empty string when the link is from a secure site.

For example, if PageA.htm includes a link to PageB.htm, and
the user clicks that link, the document.referrer on PageB.htm
returns "PageA.htm". However, if the user is on PageA.htm
and types PageB.htm into the address line or uses Open in
the File menu to get to PageB.htm, the document.referrer
returns an empty string.
  I think that the important part is the last part of the first

  In the tests that I did, I couldn't get referrer to have a value
as long as the reference was from "the same site."  I presume
that this is because the referrence was considered to be from
"a secure site."

  You might need to save the "current page" in a session cookie,
and check this value when your page is loaded.  If the "previous
page" (i.e., the value of "current page" cookie) is inappropriate,
then the form would need to be reloaded.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ralphsautoAuthor Commented:
I am still trying to work this out so if there was a way to keep this, so that I can review it more later.  I agree HonorGod should get the points, and no one else has seen fit to make any replies.
... indeed, I was tacitly agreeing with HonorGod.  Peace and joy.  mvan
ralphsautoAuthor Commented:
I will close the question and split the points between the two people who answered the question, they did answer the question in good faith, even if the answer is one I did not want to hear.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.