Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.

stop refresh by holding F5 .... please help

 
Post new topic   Reply to topic    Smarty Forum Index -> General
View previous topic :: View next topic  
Author Message
muj
Smarty n00b


Joined: 17 Aug 2016
Posts: 1

PostPosted: Sun Aug 21, 2016 8:59 am    Post subject: stop refresh by holding F5 .... please help Reply with quote

I want to stop refresh page in order to stop the hints ++ when vistors hold the F5 button .
To do this I use the code by a Java script but it does not work ..
any edias Please I need help..

these code i put it before php code

[code]<html>
<body>
{literal}

<script language="javascript" type="text/javascript">
//this code handles the F5/Ctrl+F5/Ctrl+R
document.onkeydown = checkKeycode
function checkKeycode(e) {
var keycode;
if (window.event)
keycode = window.event.keyCode;
else if (e)
keycode = e.which;

// Mozilla firefox
if ($.browser.mozilla) {
if (keycode == 116 ||(e.ctrlKey && keycode == 82)) {
if (e.preventDefault)
{
e.preventDefault();
e.stopPropagation();
}
}
}
// IE
else if ($.browser.msie) {
if (keycode == 116 || (window.event.ctrlKey && keycode == 82)) {
window.event.returnValue = false;
window.event.keyCode = 0;
window.status = "Refresh is disabled";
}
}
}
</script>
{/literal}
</body>
</html>[/code]
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Smarty Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP