Completely shield right-click, save as, and view source files

Source: Internet
Author: User

The method is as follows:

1. Save the ban

The above two steps show youSource codeIt's safe, but don't forget that you can save your page and analyze it slowly. But don't worry. Let's solve this problem.

Add the following to the webpage you want to keep confidential:Code:

<NoScript> <IFRAME src = "*. htm"> </iframe> </NoScript>

2. Forbidden to view source code
We have disabled the right-click menu, but the source code can also be seen in the "source file" under the "View" menu. Here we will solve this problem:
In fact, you only need to use a webpage with the <frame> </frame> mark to achieve the goal.
<Frameset>
<Frame src = "the URL of the file you want to keep confidential">
</Frameset>
In this way, when someone uses "View" the "source file", the above Code is displayed,

3. Completely shield the right-click method. <Body oncontextmenu = "Return false">

4. Prevent Frame
<Script language = JavaScript> <! --
If (top. location! =

Self. Location) top. Location = self. location;
// --> </SCRIPT> 5. Always carry the framework
<Script language = "JavaScript"> <! --
If (window = Top) top. Location. href = "frames.htm ";

// Frames.htm is the webpage
// --> </SCRIPT> 6. Disable source File Viewing. <HTML>
<Head>
<SCRIPT>
Function clear (){
Source = Document. Body. firstchild. Data;
Document. open ();
Document. Close ();
Document. Title = "unable to see source code ";
Document. Body. innerhtml = source;
} </SCRIPT>
</Head>
<Body onload = clear ()>
<! --
<A href = "http://www.jb51.net"> <a href = 'HTTP: // www.jb51.net 'target = '_ blank'> <font color = Red> script </font> </a> Home </a> unfortunately you cannot see it!
-->
</Body>
</Html> 7. Another method I visited online today. I accidentally found a code that can block the source file. I personally think it is not bad, so I will send it to you! During the test, I found that the Code seems to have blocked some settings in cookies and re-directed the settings so that I could not view the source file code. This is just my guess, however, it is not necessarily because some JS experts are still waiting for the evaluation. In addition, no matter whether it is in FrontPage or in Dreamweaver, the content in the body area cannot be viewed, it must be written in the code, however, if you edit the content directly in the design area, the content cannot take effect and will not be displayed! Required to write the content in <! --> Here, it takes effect. I randomly found a web page for testing and found that CSS is invalid in the web page, no matter whether the CSS file is called or the CSS is written on the current page.
It is also found that if you press F5 to refresh, all content will be refreshed. You must re-open the page to restore the content on the page. Haha, it's interesting... I will provide this code below, and you will be interested to test it. <Head>
<Meta http-equiv = "Content-Type" content = "text/html; charset = gb2312"> <script language = "JavaScript">
Function clear () {source = Document. Body. firstchild. Data; document. open ();
Document. Close (); document. Title = "the webpage name is written here ";
Document. Body. innerhtml = source ;}
</SCRIPT> <style type = text/CSS>
Body {font-size: 12px}
</Style> <! --
<P align = "center"> </P>
<P align = "center"> </P>
<P align = "center"> </P>
<P align = "center"> </P>
<P align = "center"> </P>
<P align = "center"> do not view source file code! <Br>
Test! Test! Test! <Br/>
Test! Test! Test! <Br/>
Test! Test! Test! <Br/>
Test! Test! Test! <Br/>
Test! Test! Test! <Br/>
Test! Test! Test! <Br/>
Test! Test! Test! <Br/>
Test! Test! Test! <Br/> </P>
-->
</Body>

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.