rejetto forum
Software => HFS ~ HTTP File Server => HTML & templates => Topic started by: d95gas on April 06, 2016, 05:58:56 PM
-
Hi All,
Been a while since I have been on, and some fantastic work been done in the that time.
I am hoping someone can point me in the right direction. I want to be able to disable RIGHT mouse click when the web page for HFS is running, to prevent the users from doing anything than clicking on the file to open/download.
Hoping someone might have an answer.
Thanks
-
hi,
you will find the code you need somewhere on google, then
1. ensure it is enclosed within <script> tags
2. go to hfs, in the "virtual file system" box, right clik on the first element (HOME)
3. properties
4. diff template
5. enter this text:
[+]
<script>
insert your code here
</script>
-
Thanks for the quick reply.
I followed your instructions to the letter posting the code as indicated below. When I open the site (localhost) it will open the page without anything showing on the page other than the header.
<script language="javascript">
document.onmousedown=disableclick;
status="Right Click Disabled";
Function disableclick(e)
{
if(event.button==2)
{
alert(status);
return false;
}
}
</script>
I am obviously missing the point somewhere :-(
Thanks
-
http://stackoverflow.com/questions/737022/how-do-i-disable-right-click-on-my-web-page
html code it:
<script language="javascript">
document.addEventListener("contextmenu", function(e){
e.preventDefault();
}, false);
}
document.onmousedown=disableclick;
status="Right Click Disabled";
Function disableclick(e)
{
if(event.button==2)
{
alert(status);
return false;
}
}
</script>
Jquery will work better with HFS
<script language="javascript">
// With jQuery
$(document).on({
"contextmenu": function(e) {
console.log("ctx menu button:", e.which);
// Stop the context menu
e.preventDefault();
},
"mousedown": function(e) {
console.log("normal mouse down:", e.which);
},
"mouseup": function(e) {
console.log("normal mouse up:", e.which);
}
});
</script>
-
Tried that and all I get when I load up a page is "Jquery will work better with HFS "
Thanks anyway
-
that base info, that not a complete code... see the web link provided with info regarding these two codes, that are still ways to "stop this".....
but here is a working html code, you can drop into the different template tab
<head>
<script language="javascript">
// With jQuery
$(document).on({
"contextmenu": function(e) {
console.log("ctx menu button:", e.which);
// Stop the context menu
e.preventDefault();
},
"mousedown": function(e) {
console.log("normal mouse down:", e.which);
},
"mouseup": function(e) {
console.log("normal mouse up:", e.which);
}
});
</script>
<script language="javascript">
document.addEventListener("contextmenu", function(e){
e.preventDefault();
}, false);
</script>
</head>
<body>
<p> test, you can't mousr click </p>
</body
-
sorry for the long wait, d95gas.
my advice was correct, but a bug in HFS prevented it from working.
It will work in HFS 2.3h
After fixing i tried your code, and found a typo: "Function" must be all lowercase.
-
http://www.rejetto.com/forum/hfs-~-http-file-server/2-3h-preview/