Examples of the use of masks in JS

Source: Internet
Author: User
This article introduces the application of the shielding in the next JS; screen content selected, cut, copied and screen in short, you can imagine that there should be, interested friends can refer to, I hope to learn more about JS help

JS Shielding effect

Copy Code code as follows:


/** Shielding F1 help */
Window.onhelp = function () {return false;}
/**
* Masks F5, CTRL + N, SHIFT+F10, ALT+F4
* If you want to block other keys, find the corresponding keycode and then follow this method
/
Document.onkeydown = Fun Ction (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;
}
}
/** screen mouse right button/
Document.oncontextmenu = function () {return false;}
/or
Document.onmousedown = function (event) {
event = Window.event | | event;
if (document.all && Event.button = 2) {
Event.returnvalue=false;
}
}
/**
* Mask back function (<a href= javascript:replacelocation (' http://www.google.com ') "mce_href=" Javascript:replacelocation (' http://www.google.com ') ">Google</a>"
* @param url to the URL page to be turned to the URLs
* *
function replacelocation (URL) {
DOcument.location.replace (URL);
}
/** the contents of the selected Web page/
Document.onselectstart=function () {return false;}
/** screen copy of Web page content */
Document.body.oncopy = function () {return false;}
/** Screen Cut page content */
Document.body.oncut = function () {return false;}
/** screen paste content to Web page */
Document.body.onpaste = function () {return false;}
/** Shield screen (keep the clipboard empty)/
Window.setinterval (' Window.clipboarddata ("Text", "") ', 100);
/**
* Mask View source file (<body onload=clear () >)
/
Function Clear () {
var source=document.body.first Child.data;
Document.open ();
Document.close ();
Document.body.innerHTML = source;
}
/**
* Mask js error
/
function Killerror ()
{
return true;
}
Window.onerror=killerror;

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.