The shielding in JS

Source: Internet
Author: User

Original source: http://blog.csdn.net/cjz_huateng/article/details/9622533

/** Shielding F1 Help */
Window.onhelp = function () {return false;}

/**
* Shielded F5, CTRL + N, SHIFT+F10, ALT+F4
* If you want to block other keys, find the corresponding KeyCode and follow this method
*/
Document.onkeydown = function (event) {
event = Window.event | | Event
if (event.keycode==116 | | (Event.ctrlkey && event.keycode==78) | | (Event.shiftkey && event.keycode==121) | | (Event.altkey && event.keycode==115)) {
Event.keycode = 0;
Event.returnvalue = false;
}
}

/** Shield right mouse button */
Document.oncontextmenu = function () {return false;}

Or

Document.onmousedown = function (event) {
event = Window.event | | Event
if (document.all && Event.button = = 2) {
Event.returnvalue=false;
}
}

/**
* Shielded "back" function (<a href= "javascript:replacelocation (' http://www.google.com ')" mce_href= "Javascript:replacelocation ( ' http://www.google.com ') ">Google</a>)
* @param URL page to turn to
*/
function replacelocation (URL) {
Document.location.replace (URL);
}

/** Blocking selected Web content */
Document.onselectstart=function () {return false;}

/** screen Copy Web content * *
Document.body.oncopy = function () {return false;}

/** Shielding Cut Web content * *
Document.body.oncut = function () {return false;}

/** screen paste content to Web page */
Document.body.onpaste = function () {return false;}

/** Shielded copy screen (keep clearing the Clipboard) */
Window.setinterval (' Window.clipboarddata ' ("Text", "") ', 100);

/**
* Shielded View Source file (<body onload=clear () >)
*/
function Clear () {
var source=document.body.firstchild.data;
Document.open ();
Document.close ();
Document.body.innerHTML = source;
}

/**

* Block JS Error

*/

function Killerror ()

{

return true;

}

Window.onerror=killerror;

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.