最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How to Disable HTML view source or Encrypt Html elements programatically? - Stack Overflow

programmeradmin2浏览0评论

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 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?

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 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?

Share Improve this question edited Apr 1, 2013 at 16:04 tereško 58.5k25 gold badges100 silver badges150 bronze badges asked Jul 11, 2012 at 7:33 Vinod VutpalaVinod Vutpala 8533 gold badges11 silver badges17 bronze badges 1
  • 5 If it can be rendered by a browser, it can be viewable by browser addons like Firebug. This might be useful to you myfavoritegadgets.info/truth.html – kiranvj Commented Jul 11, 2012 at 7:36
Add a ment  | 

6 Answers 6

Reset to default 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/

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

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.

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. 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;">

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/23731.js" type="text/javascript"> </script> <script src="http://www.erchima/24364.js" type="text/javascript"></script>

copyright: www.erchima

Note: - you can change # to image url

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/docs/whyamd.html

发布评论

评论列表(0)

  1. 暂无评论