-2

I saw How to hide html source & disable right click and text copy? . One of the answers say use ctrl+u to view the source. But, using shortcut.js I can override ctrl+u as well. How do I view source in that case.

7
  • off course we can stop the scripts, is there any other way Commented Apr 9, 2012 at 19:11
  • 1
    wget is always pretty easy too.. Commented Apr 9, 2012 at 19:12
  • 1
    You can use Ajax. Check my answer please. Commented Apr 9, 2012 at 19:25
  • for the downvoters: this isn't a bad question as it strikes at something fundamental. The problem is the approach to a solution that is broken. All that's needed is direction. Commented Apr 9, 2012 at 19:40
  • @shiplu.mokadd.im cool. a situation where wget or curl will fail. Commented Apr 9, 2012 at 19:44

9 Answers 9

5

There is no way to prevent this. Someone could easily download the page using a non-browser tool like curl or wget, or log all HTTP traffic with Wireshark.

Sign up to request clarification or add additional context in comments.

Comments

3

Use this. http://www.fiddler2.com/

Comments

3

Depends on the browser, but you can go to View -> Page Source in most to view the source. You cannot override that, however.

Furthermore, it's considered bad practice, and someone could also just as easily override the functionality through a tool like Firebug.

Comments

2

You can't stop people. It will be passed over the network, and sniffable through Fiddler, or someone can use a text based browser, or disable Javascript entirely, or look through their cache folder for the files they downloaded from your site.

You cannot stop people from seeing your source.

Comments

1

Well it's not possible to prevent users from seeing your script. But what you can do is to make it mire harder that user quits trying after few common methods.

I recommend you to load an initial page. Then load the whole page by using ajax. You can show a friendly loading gif too. This technique has following adanages,

  • browsers don't show generated HTML. Developers knw how to see this. But Normal user will not find it easily
  • if any user just press Ctrl+u it'll show the initial page.
  • wget, curl tool will not work at the first time.
  • additionally you can obfuscate the main page (which you are going to load by Ajax).

Comments

1

It's nearly impossible to stop people fetching the HTML from your website. I don't see any reason you'd want to hide it in the first place anyway. Hiding something?

Comments

0

Want to view the source no matter what javascript is being used to hide it? cURL the page.

Comments

0

Even if you disable right-click, you can still do a snapshot by pressing the prt scrn key on your keyboard then pasting it into an image editor.

You can't disable it. There are ways to encrypt it, but way more trouble than it's worth.

Comments

0

It's impossible to hide the source, HTML and Javascript are interpreted languages, that mean the browser will "compile" the code on the clients machine.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.