Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 11 of 11
  1. #1
    New Coder
    Join Date
    Jul 2002
    Posts
    45
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Stop page from being added to the history

    I need to stop a page being added to the history as it is being loaded. Is there a quick and easy way of doing this.

    I'm sure I've seen this done somewhere before but I cant find anything on it now.

    Thanks

    Steve.

  • #2
    New Coder
    Join Date
    Jan 2003
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Code:
    location.replace(url)

  • #3
    New Coder
    Join Date
    Jul 2002
    Posts
    45
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Sorry thats not it.

    I need the browser to display the page but make it look to the browser that that page had not been opened. I cant specify an url because I don't want the page to be reloaded I just need to move back to it in the history.

    so when I click the back button it takes me back to the page I was on previously before.

    the problem is is that the page I dont want recording in the history may be re loaded more than once. when I click the back button I need it to take me back to the page previous to the one that I dont need loading.

    If that makes sense.

    thanks

    Steve.

  • #4
    Regular Coder
    Join Date
    Aug 2002
    Location
    Spain
    Posts
    420
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Sorry, but no, it makes no sense

    Why don't you use an example or explain why do you want the page to be loaded, reloaded, opened or whatever...?
    Don't resist to assimilation. Billions of Borgs can't be wrong!

  • #5
    Senior Coder
    Join Date
    Jun 2002
    Location
    near Oswestry
    Posts
    4,508
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You can't.

    location.replace will replace the current page in the browser's history with a new one (and display the new one); you can also skip over pages in the history, with things like history.go(-2); but that's the full extent of your control over history recording - you cannot affect what happens in the history when the back button is pressed.

    Why do you need this? I've seen hundreds of posts asking how to manipulate history, and in %99.9 of cases there was another answer.

  • #6
    New Coder
    Join Date
    Jul 2002
    Posts
    45
    Thanks
    0
    Thanked 0 Times in 0 Posts

    ok i'll try to explain what I mean a little better

    ok

    page 1 (this links to a page with a form)

    page 2 (page contains a form with a combo box which reloads the page, this can be done multiple times)

    when page 2 is submitted it brings up page 3 which tells the user that the form has been sent. at the bottom of the page is a link to move back. now I need the link to go straight back to page 1 no matter how many times page 2 has been displayed. I cant link directly to the page as it is an asp page that requires values passed from the previous page so I need to step back in the history.

    Its a weird setup but its the only way it can be done as the pages are communicating with a foxpro com compontent at the back end and I need to keep the flow of values which would be lost if I simply reloaded the page.

    I hope that makes a little more sense.

    Thanks

    Steve.

  • #7
    Senior Coder
    Join Date
    Jun 2002
    Location
    near Oswestry
    Posts
    4,508
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Well then history.go(-2) might server you ...


    But trust me .. it's the wrong approach

    - if you need to reload the processed-state of page 1 then you need page 3 to send its information back to page 1 via an automatic POST - write the information into a hidden form and POST back to page 1 with <body onload="document.forms.myform.submit()">

    But this is not absolutely ideal - because it relies on javascript.

    I think the best overall solution would be don't have a page 3 at all - after processing the data on page 2, send your user back to page 1, with a confirmation message written on that
    Last edited by brothercake; 02-26-2003 at 04:36 PM.

  • #8
    New Coder
    Join Date
    Jul 2002
    Posts
    45
    Thanks
    0
    Thanked 0 Times in 0 Posts

    the only way I can think of

    I cant use the -2 as suggested because the user may reload the page 1, 2 or 100 times.

    If I can stop the history from recording the page then -1 will work all the time.

    the only way I can think of doing this is to hold a counter as a session variable on the page and use this via a java function to record how many times page 2 has been displayed and then use something like

    javascript:history.go(-session("counter"))

    i know thats not right but you get the gist.

    I'm open to any better ideas but its looking like this is the only way forward.

    Thanks for your help

    Steve.

  • #9
    Regular Coder
    Join Date
    Jan 2003
    Posts
    867
    Thanks
    4
    Thanked 8 Times in 8 Posts
    Don't you still have access to the variables on page 3? I think the best way is to link back to page 1 and pass all the variables back to it.

  • #10
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,048
    Thanks
    0
    Thanked 251 Times in 247 Posts
    why can't you just settle for this link in page 3 instead of using a session variable to record how many times page 2 reloaded?

    <a href="page1.htm">Back to page 1</a>

    are you passing querystrings to access page 1?

  • #11
    New Coder
    Join Date
    Jul 2002
    Posts
    45
    Thanks
    0
    Thanked 0 Times in 0 Posts

    because

    Page 1 is an active server page and picks up values from the previous page posted on a form to be able to run, if I just link back to the page the values will not be present and the page will not work correctly.

    Thats why I need to be able to step back in the history but I need to bypass page 2 as this page enables the user to update a database at the back end and I dont want them to have to navigate past it again once it has been posted.

    Cheers

    Steve.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •