"Go" prevents others from viewing the source code of your Web page

Source: Internet
Author: User

Original URL: http://zhidao.baidu.com/link?url= Nbezzyd1tkttvqv4fq92vdneq2krre7mu0cxn65ivieb1b4sc-jlqcmmu8u4c3jw3s5y2mhxe_ls77kp0-nnr_

Completely prohibit viewing Web page source code
Block out the right-click, copy, and select the complete code:
<script>
Document.oncontextmenu=new Function ("return false")
Document.onselectstart=new Function ("return false")
</script>
Select text or right-click to see

Or

<body oncontextmenu= "return false" onselectstart= "return false" >
Select text or right-click to see

How to View source code
----to prevent visitors from viewing the source code of the Web page, first look at how to view the source code (IE 5.0 for example). One is the right-click menu mode; Second, the Window menu bar viewing mode, that is, select "View" * "source file" mode. To completely prohibit visitors from viewing the source code of the Web page, you must block these 2 ways to view the source code.

Screen right-click menu viewing mode
----Now, many Web pages use the following code to screen the right-click menu:
< Script language=javascript>
function Click () {
if (event.button==2) {alert
(' Screen right-click menu ');
}}
Document.onmousedown=click;
</script>

"Go" prevents others from viewing the source code of your Web page

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.