javascript to disable the REFRESH functionality in a browser

Discussion in 'HTML' started by Matt, Jul 31, 2004.

  1. Matt

    Matt Guest

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

    Please advise. Thanks!!
     
    Matt, Jul 31, 2004
    #1
    1. Advertising

  2. Matt

    Spartanicus Guest

    (Matt) wrote:

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


    No.

    >Please advise.


    Why do you want to such a silly thing?

    --
    Spartanicus
     
    Spartanicus, Jul 31, 2004
    #2
    1. Advertising

  3. Matt

    rf Guest

    Matt wrote:
    > By using javascript, is it possible to disable the REFRESH
    > functionality (F5 or refresh icon) in a browser?
    >
    > Please advise. Thanks!!


    Where shall I advise? Here or over at com.lang.javascript?

    You have so far wasted one persons time, in that you have two identical
    answers in two seperate newsgroups.

    Are you ever going to learn how to post? I thought not. You probably don't
    even read these replies.

    --
    Cheers
    Richard.
     
    rf, Jul 31, 2004
    #3
  4. Matt

    amod_ranade

    Joined:
    Dec 5, 2008
    Messages:
    1
    It is possible to stop page refresh using javascript.

    Hi Matt,
    It is possible to stop page refresh using javascript.
    All that you have to do is just copy this piece of code in your <HEAD> tag of HTML page (or where you have your other javascript functions).
    function showKeyCode(e)
    {
    //alert("Inside function showKeyCode(e)");
    var keycode =(window.event) ? event.keyCode : e.keyCode;

    if(keycode == 116)
    {
    event.keyCode = 0;
    event.returnValue = false;
    return false;
    }
    }

    And call this function on onKeyDown event in your <BODY> tag.
    I have used this code and have been successfuly to stop the page refresh.

    Enjoy!!!!!
     
    amod_ranade, Dec 5, 2008
    #4
  5. Matt

    farukcse

    Joined:
    Sep 21, 2010
    Messages:
    1
    Dear amod_ranade,
    i am trying to use your procedure but it's not working .
    so can you tell me what's the wrong with me?

    Code:
    
     inside the HEAD section:
    
    <script type="text/javascript">
    function showKeyCode(e)
    {
    alert("Inside function showKeyCode(e)");
    var keycode =(window.event) ? event.keyCode : e.keyCode;
    
    if(keycode == 116)
    {
    event.keyCode = 0;
    event.returnValue = false;
    return false;
    }
    }
    </script>
    
    With Body section
    
    <body  onKeyDown ="showKeyCode();">
    
    

     
    farukcse, Sep 21, 2010
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    1
    Views:
    667
    Grant Wagner
    Dec 6, 2004
  2. Replies:
    2
    Views:
    4,012
    Tim Williams
    Dec 7, 2004
  3. Matt
    Replies:
    6
    Views:
    279
    Richard Cornford
    Aug 16, 2004
  4. Replies:
    1
    Views:
    184
    Grant Wagner
    Dec 6, 2004
  5. Replies:
    2
    Views:
    274
    Tim Williams
    Dec 7, 2004
Loading...

Share This Page