javascript to disable the REFRESH functionality in a browser

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Matt

    javascript to disable the REFRESH functionality in a browser

    By using javascript, is it possible to disable the REFRESH
    functionality (F5 or refresh icon) in a browser?

    Please advise. Thanks!!
  • Michael Winter

    #2
    Re: javascript to disable the REFRESH functionality in a browser

    On 30 Jul 2004 16:34:33 -0700, Matt <jrefactors@hot mail.com> wrote:
    [color=blue]
    > By using javascript, is it possible to disable the REFRESH
    > functionality (F5 or refresh icon) in a browser?[/color]

    No.
    [color=blue]
    > Please advise. Thanks!![/color]

    Happy to be of service. :)

    Mike

    --
    Michael Winter
    Replace ".invalid" with ".uk" to reply

    Comment

    • Thomas 'PointedEars' Lahn

      #3
      Re: javascript to disable the REFRESH functionality in a browser

      Matt wrote:[color=blue]
      > By using javascript, is it possible to disable the REFRESH
      > functionality (F5 or refresh icon) in a browser?[/color]

      No. Besides, I use Ctrl(+Shift)+R for refresh in my Mozilla Firefox.
      [color=blue]
      > Please advise. Thanks!![/color]

      Revise your Web application. You're welcome, though this question has
      been asked too much.


      PointedEars

      Comment

      • Robert

        #4
        Re: javascript to disable the REFRESH functionality in a browser

        jrefactors@hotm ail.com (Matt) wrote in message news:<ba8a039e. 0407301534.3e28 c382@posting.go ogle.com>...[color=blue]
        > By using javascript, is it possible to disable the REFRESH
        > functionality (F5 or refresh icon) in a browser?[/color]

        Why would you want to do this?

        You cannot do this on the client. You could implement it on the
        server by detecting a refresh and not doing the refresh. Don't ask me
        how it is done, but I have seen it done on my local library book
        renewal page. The library server program won't let me refresh the
        page were I have the list of books checked out. The program forces me
        to reenter my password before it will let me see my list of books.

        [color=blue]
        > Please advise. Thanks!![/color]

        Robert

        Comment

        • Glen Spove

          #5
          Re: javascript to disable the REFRESH functionality in a browser

          Yes it is possible.

          In a function capturing onkeydown, type:

          event.keyCode = 0; //or any other number but F5
          event.returnVal ue = false;
          return false;



          This works...

          *** Sent via Developersdex http://www.developersdex.com ***
          Don't just participate in USENET...get rewarded for it!

          Comment

          • Randy Webb

            #6
            Re: javascript to disable the REFRESH functionality in a browser

            Glen Spove wrote:[color=blue]
            > Yes it is possible.
            >
            > In a function capturing onkeydown, type:
            >
            > event.keyCode = 0; //or any other number but F5
            > event.returnVal ue = false;
            > return false;[/color]

            And how, exactly, does that stop me from clicking the Refresh button?
            [color=blue]
            > This works...[/color]

            No it doesn't, you just think it does.

            --
            Randy
            comp.lang.javas cript FAQ - http://jibbering.com/faq

            Comment

            • Richard Cornford

              #7
              Re: javascript to disable the REFRESH functionality in a browser

              Glen Spove wrote:[color=blue]
              > Yes it is possible.[/color]

              You are referring to something in particular? Maybe the disabling of the
              refresh functionality in a web browsers? That is emphatically not
              possible. (Hence multiple responses stating as much going uncommented by
              others.)
              [color=blue]
              > In a function capturing onkeydown, type:
              >
              > event.keyCode = 0; //or any other number but F5[/color]

              Apart from the lack of discrimination in attempting to cancel all key
              presses instead of just (the many) key sequences that would result in a
              refresh action, to the best of my recollection only IE browsers allow
              the assignment on values to keyCode events.
              [color=blue]
              > event.returnVal ue = false;
              > return false;
              >
              > This works...[/color]

              You are defining "works" as: works to inhibit only the use of the F5 key
              to refresh the page, on javascript enabled default configurations of
              Windows IE, but only when key events are passing through the document
              (which they don't necessarily have to). The use of such a lax definition
              of "works" means that whatever (harmful?) consequences follow from the
              user refreshing the page, this script has done little more than reduce
              the chances of them happening. So to exactly the extent to which those
              consequences are undesirable, this proposal is inadequate.

              Normal actions on the part of the client browser such as refreshing a
              page, or moving back and forward in the history, or opening another
              window showing the same URL (with Ctrl-N on Windows IE) should be
              anticipated by the author of a server-side system that is to use a
              browser client. They cannot be reliably prevented so instead they need
              to be anticipated and accommodated in the design of the server-side
              system. Failing to do that would be creating a web application that is
              broken by design, and unsurprisingly the normal advice in that case is
              to fix the server side.

              Richard.


              Comment

              Working...