Another kind of code that prevents others from modifying js _ hacker nature

Source: Internet
Author: User
Another type of JavaScript code that we want others to be unable to modify. We want others to be unable to modify the JavaScript code, so we can work hard on the complexity of js and use modular development, this function references that function. This object inherits from that object ..... and soon others will be dizzy ....... of course, you will also be dizzy when debugging or modifying it yourself .......... let me talk about it ..... don't hit me...

In fact, what I want to say is that if you don't want others to modify it, you can add a validation check on many JS locations. If not, so we can call it here to get rid of others...

Of course, whether this check is concealed or not, and whether it is perfect after the check is not met is something that Programmers think carefully. I just want to give an idea haha. the following is an example. I just want to express my thoughts ......

IE Only

Script // The code above cannot be modified // The following is the check if(document.doc umentElement. outerHTML. length! = 202) {document. write ('Why Do You Want To modify me? ');} Else {document. write (' I have not been modified. ');} script <! -- The following code can be modified --> script alert ("Current Loading Length:" +document.doc umentElement. outerHTML. length); script, script, alert ("Current Loading length:" +document.doc umentElement. outerHTML. length); script
[Ctrl + A select all Note: If you need to introduce external Js, You need to refresh it to execute]


FF Only

Script // The code above cannot be modified // The following is the check if(document.doc umentElement. innerHTML. length! = 175) {document. write ('Why Do You Want To modify me? ');} Else {document. write (' I have not been modified. ');} script <! -- The following code can be modified --> script alert ("Current Loading Length:" +document.doc umentElement. innerHTML. length); script, script, alert ("Current Loading length:" +document.doc umentElement. innerHTML. length); script
[Ctrl + A select all Note: If you need to introduce external Js, You need to refresh it to execute]

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.