Hide the Source

Posted on 1998-08-20
Last Modified: 2010-04-09
Hi Experts,
  How can I hide my source from user when they go to view source .
I came across a site where it display some rubbish characters when I go to view source .
Question by:seahpc
  • 2
  • 2
  • 2
  • +3

Expert Comment

ID: 1836851
I don't think there's a way to 100% hide it as once they've got the file, you've lost control.  Even if you can do it for a particular browser, they can work round it by writing their own HTTP client (MS give away sample source for these!) or using a different browser.

You can make the source hard to read or nearly useless.
1. Use a proprietary format (e.g. MacroMedia).  That way the HTML just invokes the viewer/plug-in, and all the real content is secure (kind of).  Disadvantage:user needs the reader for the content.
2. Put all your content in Java (and don't give the source out for this).  Again HTML just invokes the Java so reading the source doesn't help the user much.  Disadvantage: user must have a Java enabled browser (lots of corporate users disable Java)
3. Remove all white space, comments etc from the source making it really tough to read.
LVL 12

Expert Comment

ID: 1836852
> I came across a site where it display
> some rubbish characters when I go to view source.

Well, look in the browser's "cache" directory
on your hard-drive.  The "newest" file will be
the HTML-file which you most-recently retrieved.

Expert Comment

ID: 1836853
There is no way of hiding the soure completely, just think about it, if the source could be hidden then how could your browser read the information for that specific *.HTML page?
if you come across a page which doesnt let you look at the page source, then you probably havent finished loading up the page thats all, not because the page has "hidden its source code".... also could you tellus the page ware you saw "rubbish characters"?
Is Your AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.


Author Comment

ID: 1836854
The Site which I came across is .
Anyone who know how to create that can you please show me how or give me a simple example . Thanks
LVL 10

Expert Comment

ID: 1836855
There is not "true" way to encode your HTML code... However, there are some tricky ways to make it harder for others to get it.

1) IF you use Javascript, place all your javascripts in a ".js" file nad then call them from your HTML pages like this:
<SCRIPT LANGUAGE="JavaScript" SRC="scripts/something.js"></SCRIPT>

This will link it to an external javascript file.  You could also put that file in a protected folder so that noone could DL it... (just use it to run the scripts)

2) Use Active Server Pages.  This method leaves all the scripting on the server and it only sends the HTML output... This is so far the best method.  

Any other question...

- Matt

Expert Comment

ID: 1836856
Use ASP as your code base, this will NOT show in the source as it is run on the server. If you want to hide the HTML, well? WHY?
Is it that good? Send me a link!

Author Comment

ID: 1836857
Hi MasseyM,
   Your methods will hide  the script but the HTML content will still be shown .
  I f you have went into the site I gave earlier, thats is the kind I wish to create .
 For your info, I am using ASP . Thanks
LVL 10

Expert Comment

ID: 1836858
Their HTML is not hidden... It is much further down the page... as for the script... that is something I am currently building an app for... Also, I don't see anything on their page that even uses a script...
LVL 12

Accepted Solution

Otta earned 100 total points
ID: 1836859
You've been "tricked".

The HTML at the URL which you cite begins with an HTML comment:

 <!-- @# The script is hidden  Requires password to open ! -->

and then there are about 400 "blank" lines,
and *THEN* the complete HTML for the page is available.

You just need to "scroll-down" a _LONG_ way to view the source.

Featured Post

ScreenConnect 6.0 Free Trial

Want empowering updates? You're in the right place! Discover new features in ScreenConnect 6.0, based on partner feedback, to keep you business operating smoothly and optimally (the way it should be). Explore all of the extras and enhancements for yourself!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question