33 replies · 2,451 views · started 15 years ago · 2 min read
TL;DR · summary of 33 replies
- tkreturns asked how to disable source view in browsers like Microsoft Internet Explorer, Netscape Navigator, Firefox, and IE while ensuring compatibility with Mozilla Firefox addons that block right-click functionality...
- The thread concluded without a specific fix or code approach being provided. Some users suggested using JavaScript to disable certain browser functionalities, but others pointed out limitations such as browser cache an...
- metulj asked for an example of how to implement the idea of disabling source view in PHP, indicating that no clear solution was offered.
- The discussion highlighted various approaches and their limitations, suggesting that completely preventing users from accessing or viewing source code is challenging due to browser functionalities and user agent sniffi...
Written automatically from the replies by a language model on our own server. It can be wrong; the posts below are the source.
Many a times there is a situation where an organization wants no one to right click, copy and paste the page, print or view source etc. To achieve this one should deactivate the mouse right button and the keyboard right click button.
But the same thing can be achieved with the help of the menu bar. We have to deactivate Alt key to restrict the user from accessing menu items.
After doing this there is one more possibility from where the user can directly take the stuff from the page. Just use Ctrl + A to select the whole page and directly Ctrl + C, Ctrl + V to copy and paste respectively. This option must also be disabled.
One more issue to take care is browser compatibility. It should work in Microsoft Internet Explorer and in Netscape Navigator.
Here's the code:
var isnn,isie
if(navigator.appName=='Microsoft Internet Explorer') //check the browser
{ isie=true }
if(navigator.appName=='Netscape')
{ isnn=true }
function right(e) //to trap right click button
{
if (isnn && (e.which == 3 || e.which == 2 ))
return false;
else if (isie && (event.button == 2 || event.button == 3))
{
alert("Sorry, you do not have permission to right click on this page.");
return false;
}
return true;
}
function key(k)
{
if(isie) {
if(event.keyCode==17 || event.keyCode==18 || event.keyCode==93) {
alert("Sorry, you do not have permission to press this key.")
return false;
}
}
if(isnn){
alert("Sorry, you do not have permission to press this key.")
return false; }
}
if (document.layers) window.captureEvents(Event.KEYPRESS);
if (document.layers) window.captureEvents(Event.MOUSEDOWN);
if (document.layers) window.captureEvents(Event.MOUSEUP);
document.onkeydown=key;
document.onmousedown=right;
document.onmouseup=right;
window.document.layers=right;
Put this code in a file called security.js and reference it between the <HEAD> and </HEAD> tags of any html or asp page using: <Script language="JavaScript" src="security.js"></script>
tkreturns wrote:
Many a times there is a situation where an organization wants no one to right click, copy and paste the page, print or view source etc. To achieve this one should deactivate the mouse right button and the keyboard right click button.
But the same thing can be achieved with the help of the menu bar. We have to deactivate Alt key to restrict the user from accessing menu items.
After doing this there is one more possibility from where the user can directly take the stuff from the page. Just use Ctrl + A to select the whole page and directly Ctrl + C, Ctrl + V to copy and paste respectively. This option must also be disabled.
One more issue to take care is browser compatibility. It should work in Microsoft Internet Explorer and in Netscape Navigator.
Here's the code:
var isnn,isie
if(navigator.appName=='Microsoft Internet Explorer') //check the browser
{ isie=true }
if(navigator.appName=='Netscape')
{ isnn=true }
function right(e) //to trap right click button
{
if (isnn && (e.which == 3 || e.which == 2 ))
return false;
else if (isie && (event.button == 2 || event.button == 3))
{
alert("Sorry, you do not have permission to right click on this page.");
return false;
}
return true;
}
function key(k)
{
if(isie) {
if(event.keyCode==17 || event.keyCode==18 || event.keyCode==93) {
alert("Sorry, you do not have permission to press this key.")
return false;
}
}
if(isnn){
alert("Sorry, you do not have permission to press this key.")
return false; }
}
if (document.layers) window.captureEvents(Event.KEYPRESS);
if (document.layers) window.captureEvents(Event.MOUSEDOWN);
if (document.layers) window.captureEvents(Event.MOUSEUP);
document.onkeydown=key;
document.onmousedown=right;
document.onmouseup=right;
window.document.layers=right;
Put this code in a file called security.js and reference it between the <HEAD> and </HEAD> tags of any html or asp page using: <Script language="JavaScript" src="security.js"></script>
SCRIPTS FOR SALE BY SUBZERO
Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders.
FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others...
_______…
No matter how hard you try; there is always the browser cache there is no way to stop that. Also Telnet, C/C++/c#/VB via Windows Sockets or I-Net Libs. Online source code viewers. This list could go on and on for days is there really a point with protecting it. JavaScript in Opera can just be turned of with a tick box for that specific site i guess it is true for other browsers.
Extract encrypt.zip to your web server and Just put
include 'encrypt.php';
in the beginning of your web page script.
The HTML content will be automatically encrypted via Base64 algorithm so nobody can view it
fyzan wrote:
Extract encrypt.zip to your web server and Just put
include 'encrypt.php';
in the beginning of your web page script.
The HTML content will be automatically encrypted via Base64 algorithm so nobody can view it
base64 can be decrypted with one line of code. :-/
SCRIPTS FOR SALE BY SUBZERO
Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders.
FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others...
_______…
SCRIPTS FOR SALE BY SUBZERO
Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders.
FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others...
_______…