Click here to Skip to main content
14,922,433 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi all!,

I want to disable refresh button of all browser or I would like show there custom message in div. Please provide solution whether in Server side or client side.
Updated 25-Dec-19 20:26pm
syed shanu 4-Dec-14 2:40am
use google before asking questions .There is lots of samples available from google.Check few links.
Sri Nitish 4-Dec-14 3:17am
Dear Mr. Syed..... I had used google but solution is same that you provided but that's not my need coz they providing solution for F5. But I want to disable either refresh button or display my custom message in div.

Best solution is to open your Page with no Toolbar.
C# ("yourPageURL","mywindow","status=1,toolbar=0");
P Nagendra11 26-Dec-19 2:27am
Please give suggestion for this " ("yourPageURL","mywindow","status=1,toolbar=0")"
yourPageURL value will like this ""
mywindow what will be the of value ?- Any one tell this value for this Thank you
You can disable the ctrl+f5 and only f5 button/keypress using javascript. Below are few links you can follow up with:-
Disable Refresh[^]
Disable Refresh 2[^]
But dear disabling the refresh icon on the browser is next to impossible. Like disabling the back button we manipulate with the browser history. But We cant manipulate with the browser defaults.
I hope this helps you.
Post back your queries if any.
[no name] 4-Dec-14 2:50am
Thanks a lot Tadit . :)
Sri Nitish 4-Dec-14 3:13am

Here I am trying to show message in dialog (div) when user try to refresh on 'onbeforeunload' as below

$(window).on('beforeunload', function (event) {
return Show();
//return '>>>>>Before You Go<<<<<<<< \n Your custom message go here';

function Show()
$('#div').dialog({ modal: true });
but this not working properly coz pege getting refreshed.
[no name] 4-Dec-14 3:18am
Did you check in the developer tool debugging if the script is working as t should?
[no name] 4-Dec-14 3:20am
Check this. It says beforeunload doesnot work in all browsers.
This has a solution try out with that.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900