Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


Hide the Source

Posted on 1998-08-20
Medium Priority
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
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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"?
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

This is a PowerShell web interface I use to manage some task as a network administrator. Clicking an action button on the left frame will display a form in the middle frame to input some data in textboxes, process this data in PowerShell and display…
Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
In this Micro Tutorial viewers will learn how to create navigation buttons that change on rollover, using CSS (Continuation of the CSS Image Sprite tutorial) Create a parent ID for all the list items       - Specify position: absolute and display: block…
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…

664 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