0

Hello all!
I am using a little piece of code in a report I'm generating (LogiXML). It is a "back" button that takes the user back to the previous page.. It does not however, use any form of a history, back, location javascript code. It just uses a plain old link directly to the page prior. I am rather partial to the history.back statement though because it always seemed much faster. (Possibly the page already being loaded in the cache, I'm not sure.) I'd like to make though, that the history.back() command will always take me to the page it should be going to. So if the history.back.value (in theory) is equal to "load.htm" (the page it should be going to) then proceed to history.back(), else, window.location = "load.htm";... Could someone instruct me on the correct syntax for this? Thank you very much!

2
Contributors
2
Replies
6
Views
5 Years
Discussion Span
Last Post by PhilEaton
1

I'd like to make though, that the history.back() command will always take me to the page it should be going to

So it sounds like you are familiar with the history object in JavaScript. Yes, executing this method would take the user to the previous page.

Example code:

<script type="text/javascript">
  function prevPage(){
    window.history.back();
  }
</script>

<a href="javascript:void(0);" 
    onclick="prevPage()">-- Previous Page --</a>
0

Right, I just want to be able to check the location of that page (i.e. the url) and make sure it is the page I intend for it to go. I did not create this page so I am not sure if the page where I came from previously will be the page where everyone comes previously. I need to make sure that the value for the history.back() function will take the user to the create url. If not, I want it to resort to the (slower) window.location function which will guarentee the return to the proper page. Thanks!

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.