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. Dealing with browser back button after logging out

Dealing with browser back button after logging out

Scheduled Pinned Locked Moved ASP.NET
javascriptquestion
4 Posts 3 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.
  • D Offline
    D Offline
    dptalt
    wrote on last edited by
    #1

    After logging out of my web application I do not want the user to be able to get back into it simply by clicking the browser Back button. After doing some reading I don't think javascript will allow you to clear browser cache. Do I have to prevent all my asp pages from being cached? On commercial sites it seems that caching is on because the Back button does work. However, after logging out and hitting the Back button an expired page is displayed. How do they do this?

    P A D 3 Replies Last reply
    0
    • D dptalt

      After logging out of my web application I do not want the user to be able to get back into it simply by clicking the browser Back button. After doing some reading I don't think javascript will allow you to clear browser cache. Do I have to prevent all my asp pages from being cached? On commercial sites it seems that caching is on because the Back button does work. However, after logging out and hitting the Back button an expired page is displayed. How do they do this?

      P Offline
      P Offline
      Parwej Ahamad
      wrote on last edited by
      #2

      http://geekswithblogs.net/vivek/archive/2007/02/24/107148.aspx[^] Go with above url

      Parwej Ahamad ahamad.parwej@gmail.com

      1 Reply Last reply
      0
      • D dptalt

        After logging out of my web application I do not want the user to be able to get back into it simply by clicking the browser Back button. After doing some reading I don't think javascript will allow you to clear browser cache. Do I have to prevent all my asp pages from being cached? On commercial sites it seems that caching is on because the Back button does work. However, after logging out and hitting the Back button an expired page is displayed. How do they do this?

        A Offline
        A Offline
        Abhishek Sur
        wrote on last edited by
        #3

        Place this on every page for which you want the back shouldnt be enabled :

        function disableBack(){window.history.forward();}
        disableBack();
        window.onload=disableBack;
        window.onpageshow=function(evt){if(evt.persisted)disableBack();}
        window.onunload=function(){void(0);}

        This is tested on MSIE, FireFox, Safari and Opera. :)

        Abhishek Sur


        My Latest Articles **Create CLR objects in SQL Server 2005 C# Uncommon Keywords Read/Write Excel using OleDB

        **Don't forget to click "Good Answer" if you like to.

        1 Reply Last reply
        0
        • D dptalt

          After logging out of my web application I do not want the user to be able to get back into it simply by clicking the browser Back button. After doing some reading I don't think javascript will allow you to clear browser cache. Do I have to prevent all my asp pages from being cached? On commercial sites it seems that caching is on because the Back button does work. However, after logging out and hitting the Back button an expired page is displayed. How do they do this?

          D Offline
          D Offline
          dptalt
          wrote on last edited by
          #4

          Does this mean when you have a logout feature you cannot use the browser cache?

          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