Disable viewing of source code in Web page (protect source code)

Source: Internet
Author: User
Tags blank page

In the process of developing the website sometimes we do not want to let the customer see the source code of the page, even the text content on the page does not want to be copied, let's look at how to protect the page content
Prevent viewing of page source code and copying text from pages
<body style=" oncontextmenu="return false" onselectstart="return false">

We all know that even if you set the Disable right button but click F12 still can see the source code, below we set to prohibit the use of F12

<script> function Fuckyou () {window.close ();//close Current window (anti-suction) window.location = "About:bla NK ";            Jumps the current window to a blank page} function ck () {console.profile ();            Console.profileend ();            We judge profiles inside there is no thing, if there is, someone must press F12, yes!!            if (console.clear) {console.clear ()};            if (typeof console.profiles = = "Object") {return console.profiles.length > 0;  }} function hehe () {if (Window.console && (console.firebug | | console.table && /firebug/i.test (Console.table ()))) | | (typeof opera = = ' object ' && typeof opera.posterror = = ' function ' && console.profile.length > 0))            {fuckyou (); } if (typeof console.profiles = = "Object" && console.profiles.length > 0) {fuckyou ()            ;        }} hehe (); Window.onresize = function () {if (window.Outerheight-window.innerheight) > 200)//Judge the current window height and window height, if the difference is greater than 200, then hehe fuckyou (); }</script>

Using the above JS code can prohibit the use of F12, note: The above JS code is not my own writing, has forgotten what the great God wrote ~ ~
Finally we know that the picture in the browser mouse as long as a drag will be saved, but the background image will not be dragged, the following code can make the picture in the page disable the mouse drag
&lt;body style="ondragstart="return false"&gt;

Disable viewing of source code in Web page (protect source code)

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.