Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Browser's back and forward buttons

Browser's back and forward buttons

Scheduled Pinned Locked Moved ASP.NET
csharpjavascriptquestion
4 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    lnong
    wrote on last edited by
    #1

    Can I programatically control the browser's navigation buttons in my code? For instance, the user can navigate to several diferrent pages in my web application, but whenever he hits the "Back" button in IE, it always brings him back to the main page. The reason I want to do this is the following. Lets say that the user clicks on a link to go to a form from my main page. He fills out the form and clicks "Submit". My code then clears the textboxs. Now when the user clicks "Back" on the browser, the textboxes become refilled with stuff that he just typed in. I dont not want this. I want him to be taken straight back to the main page when he clicks "Back" in IE. So is there a way to control the browser's navigational buttons in my C# code? (or in javascript)?

    J S V 3 Replies Last reply
    0
    • L lnong

      Can I programatically control the browser's navigation buttons in my code? For instance, the user can navigate to several diferrent pages in my web application, but whenever he hits the "Back" button in IE, it always brings him back to the main page. The reason I want to do this is the following. Lets say that the user clicks on a link to go to a form from my main page. He fills out the form and clicks "Submit". My code then clears the textboxs. Now when the user clicks "Back" on the browser, the textboxes become refilled with stuff that he just typed in. I dont not want this. I want him to be taken straight back to the main page when he clicks "Back" in IE. So is there a way to control the browser's navigational buttons in my C# code? (or in javascript)?

      J Offline
      J Offline
      Jonathan321
      wrote on last edited by
      #2

      I don't know a way of writing to the browsers history, or preventing the use of the browser's Back and Forward buttons (apart from launching your site in a browser configured with no button bar), but... You could circumvent this problem by: Instead of submitting the form, copy the values to a form in a hidden frame and submit that instead, or... Replace standard navigation by use of the Javascript "location.replace();" function, which permits multiple pages to be loaded, without adding them to the browser's history. Hope this helps, Jon.;)

      1 Reply Last reply
      0
      • L lnong

        Can I programatically control the browser's navigation buttons in my code? For instance, the user can navigate to several diferrent pages in my web application, but whenever he hits the "Back" button in IE, it always brings him back to the main page. The reason I want to do this is the following. Lets say that the user clicks on a link to go to a form from my main page. He fills out the form and clicks "Submit". My code then clears the textboxs. Now when the user clicks "Back" on the browser, the textboxes become refilled with stuff that he just typed in. I dont not want this. I want him to be taken straight back to the main page when he clicks "Back" in IE. So is there a way to control the browser's navigational buttons in my C# code? (or in javascript)?

        S Offline
        S Offline
        Steve McLenithan
        wrote on last edited by
        #3

        Not possible.

        $TeVe McLeNiThAn

        1 Reply Last reply
        0
        • L lnong

          Can I programatically control the browser's navigation buttons in my code? For instance, the user can navigate to several diferrent pages in my web application, but whenever he hits the "Back" button in IE, it always brings him back to the main page. The reason I want to do this is the following. Lets say that the user clicks on a link to go to a form from my main page. He fills out the form and clicks "Submit". My code then clears the textboxs. Now when the user clicks "Back" on the browser, the textboxes become refilled with stuff that he just typed in. I dont not want this. I want him to be taken straight back to the main page when he clicks "Back" in IE. So is there a way to control the browser's navigational buttons in my C# code? (or in javascript)?

          V Offline
          V Offline
          Vasudevan Deepak Kumar
          wrote on last edited by
          #4

          Yep! Of course, but not in C#, perhaps you may use it from JavaScript. I think history.forward() would null back button and forward button effects. To null the effects of ALT +(UP/Dn) arrows, backspace key, you can try and use document.onkeydown = function { //check for keycode of the above key and null the event.keyCode to zero. } Deepak Kumar Vasudevan http://deepak.portland.co.uk/

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups