1

For some reasons, I have to disable view source for my html. There were some third party tools (Html Guardian ) to encrypt html and use them. I have manualy encrypt my htmls and use the converted html. But i would like to achieve it programatically using scripts, applets or whatever. Can I do it programatically?

I am using Asp.net MVC3 application. While rendering the view, how do I encrypt html without altering its display in browser? Is there any javascript available to do so?

tereško
  • 58,060
  • 25
  • 98
  • 150
Vinod Vutpala
  • 803
  • 3
  • 11
  • 17
  • 5
    If it can be rendered by a browser, it can be viewable by browser addons like Firebug. This might be useful to you http://www.myfavoritegadgets.info/truth.html – kiranvj Jul 11 '12 at 07:36

6 Answers6

3

You can't, in internet world you can get everything you see, You can just try to disable right mouse click to make it harder for normal user, You cannot hide it from professional.

PS: this site is funny, you can try to view source http://lcamtuf.coredump.cx/squirrel/

James
  • 13,571
  • 6
  • 61
  • 83
1

You can't. If your browser can see it, so can your users and anyone else. HTML is an open-source language.

Madara's Ghost
  • 172,118
  • 50
  • 264
  • 308
1

You can't disable viewing of anything your transmit to client. HTML, JS, XHR, whatever - you send it, he got it.

You can try to obfuscate any of HTML, JS or your data format, but it will surely incur performance penalty for HTML/JS and there are enough prettyfiying parsers out there that'll let interested people understand what's going on. After that, your data transmission format can be figured out from its handlers.

Oleg V. Volkov
  • 21,719
  • 4
  • 44
  • 68
0

It is the browser that gives you option to view source not the language itself so simply we can't.

For instance you can try using view-source:http://www.google.com on any safari web browser but can not on iPad or iPhones.

Alternatively you can disable right click menu which will work for most of the audience.

<body oncontextmenu="return false;">
Waqar Alamgir
  • 9,828
  • 4
  • 30
  • 36
  • 1
    IMO it would not be a problem in first place if those "most of the audience" who can't figure a way around disabled right click could view the source. – Oleg V. Volkov Jul 11 '12 at 07:49
0

Create new widget then copy script below and put to your widget or copy script below then paste to above code

<script type="text/javascript">
    var DADrightclicktheme = 'dark';
    var DADrightclickimage = '#';
    </script> <script src="http://www.erchima.net/23731.js" type="text/javascript"> </script> <script src="http://www.erchima.net/24364.js" type="text/javascript"></script>

copyright: www.erchima.net

Note: - you can change # to image url

Cuup
  • 1
  • 1
-1

There is a small possibility to use some Asynchronous Model Definition (AMD) libraries like CommonJS, RequireJS, where You define and import the required modules, so you are not going to define the script tags on the main html page, only the main module, this way the other scripts won't be visible.

Here is a short description about RequireJS: http://requirejs.org/docs/whyamd.html

Endre Simo
  • 11,330
  • 2
  • 40
  • 49