SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Hybrid View

  1. #1
    SitePoint Addict
    Join Date
    Dec 2001
    Location
    Market Harborough, UK
    Posts
    206
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Post Disabling buttons

    Hi, I have a website which is fronting a database. As such the pages are created dynamically (with PHP). The problem is that some users use the reload and / or Back buttons. The browser says the page has expired and do they want to repost and, of course, they say yes...

    What code do I need to use to switch off this functionality in the browser?

    TIA

    Paul
    Paul Simpson, BSc, MCNI, MCNE

  2. #2
    SitePoint Evangelist azizur_rahman's Avatar
    Join Date
    Nov 2001
    Location
    London, UK
    Posts
    502
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I am afraid to say there isn't much you can do about the Refresh/Reload feature of the browser in the client side. Try storing the values in server cookies or server session variables.

    However, you can use clientside javascript to redirect the user to corrent page if they click the back button.

    Here's the code that redirect the user back to current page/Stop user from going back.
    Code:
    <script language="JavaScript">
    <!--
    javascript:window.history.forward(1);
    //-->
    </script>
    Azizur Rahman
    Web Application Developer

  3. #3
    SitePoint Addict
    Join Date
    Dec 2001
    Location
    Market Harborough, UK
    Posts
    206
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Humm, I also don't want the current page to reload....

    I'm sure I've seen sites where the whole of the address bar / toolbar / menu bar etc. simply disappears. Is there no way to do this in JS? I apprecate F5 will still refresh, but it'd stop most of the little so-and-sos!

    TIA

    Paul
    Paul Simpson, BSc, MCNI, MCNE

  4. #4
    SitePoint Evangelist azizur_rahman's Avatar
    Join Date
    Nov 2001
    Location
    London, UK
    Posts
    502
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by pauls
    Humm, I also don't want the current page to reload....

    I'm sure I've seen sites where the whole of the address bar / toolbar / menu bar etc. simply disappears. Is there no way to do this in JS? I apprecate F5 will still refresh, but it'd stop most of the little so-and-sos!

    TIA

    Paul
    In that case load up your interface (HTML Pages) in a new window without all the menus and toolbars.
    Azizur Rahman
    Web Application Developer

  5. #5
    SitePoint Addict
    Join Date
    May 2000
    Posts
    313
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    When they submit the form are they being sent to another page? If so you might try location.replace('somepage.html') . This would replace the form page in history with the page they are redirect to. The back button would not take them back to it.


Bookmarks

Posting Permissions

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