CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
Disable refresh

 



oldtimer
Deleted

Apr 10, 2001, 9:22 AM

Post #1 of 2 (207 views)
Disable refresh Can't Post

can the right click refresh be disabled in perl?

in jscript it can be stopped with
<SCRIPT language=JavaScript>
function click(){if (event.button==2){alert('not allowed')}}document.onmousedown=click//
</SCRIPT>

but I tried to print this in my cgi and it printed but didn't work.

any ideas? I'm running a cgi counter that I don't want incremented using right click refresh.



sleuth
Enthusiast

Apr 11, 2001, 1:43 PM

Post #2 of 2 (197 views)
Re: Disable refresh [In reply to] Can't Post

 
Nope, that crosses from server side control into client side, which is why Javascript works better for that, your best bet is to print out the javascript from your perl prog, and better yet, use this javascript.


Code
<script language="JavaScript1.2">  
if (window.Event)
document.captureEvents(Event.MOUSEUP);
function nocontextmenu()
{
event.cancelBubble = true
event.returnValue = false;
return false;
}
function norightclick(e)
{
if (window.Event)
{
if (e.which == 2 || e.which == 3)
return false;
}
else
if (event.button == 2 || event.button == 3)
{
event.cancelBubble = true
event.returnValue = false;
return false;
}
}
document.oncontextmenu = nocontextmenu;
document.onmousedown = norightclick;
</script>

Tony


 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives