How to disable F5 keyword using Javascript in ?

We can disable F5 Keyword using Javascript like this

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="CloseBrowserTest.aspx.cs" Inherits="CloseBrowserTest" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">

<html xmlns="">;
<head id="Head1" runat="server">
<title>Untitled Page</title>
<script type="text/javascript">
document.attachEvent("onkeydown", my_onkeydown_handler)
function my_onkeydown_handler()
if(event.keyCode == 116)
event.keyCode = 0;
event.returnValue = false;

<body onload="return my_onkeydown_handler()">
<form id="form1" runat="server">



3 thoughts on “How to disable F5 keyword using Javascript in ?

  1. simran October 7, 2013 / 10:25 am

    nice code

  2. rosauragrasser September 8, 2014 / 10:00 pm

    I like the helpful info you provide in your articles.
    I’ll bookmark your weblog and check again here regularly.
    I’m quite certain I will learn lots of new stuff right here!
    Best of luck for the next!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.