How can i hide my html code on my website? when browsing to it using IE,i can click on View source and see all my html code.
Is there anything i can install on my server to hide my site's html code?

Thanks

I am not sure but i think there are some Code encrypting programs. If you can find one, i am sure you will do what you want.

In a word; No.

HTML is delivered to users as 'source code', which the user's browser then interprets. There is nothing you can do to protect HTML code; except trying to enforce your copyright if it's stolen.

Also, you can't easily 'scramble' or obfuscate HTML code as you would with other types of code; because even subtle changes will often have some visible effects.

The best you might get, is encrypting the page, saving it somewhere on your server; and responding to requests with a blank page that runs a Javascript function to collect, decrypt and display the page content.

But, as you can't encrypt Javascript programs either, and since you'd have to send a link in the page to a program that can collect and decrypt your pages; it's gonna by like holding sand in a sieve...

Still, you might be able to do some funky business at the server to hide the Javascript code by means of checking the referer in an HTTP header... so that only your pages can link to the JavaScript code. This still has drawbacks; some browsers might let a user see post-JS source code ( and all browsers have to download the code, and most cache it somewhere ); and it's going to greatly increase the loading times for your pages; and the pages' contents will be totally indeterminable by a search engine spider.

If you want to encrypt it, go to designerwiz.com.
Then go to js code makers, amd it's on the bottom of the page under security

Why do you want to do this? It sounds very selfish to me.

You are not going to hide any of the other files on your site that way. There are programs which can read your web directory.

The whole purpose of the web is openness. Don't try to defeat that.

I do know ways of hiding email addresses from robots, yet leaving them visible to users.

Is there anything i can install on my server to hide my site's html code?

I don't sure, that there are softs, that can be installed on server and do it on fly, but you can use some dekstop softs or online tools, that do it.

You are not going to hide any of the other files on your site that way.

sometimes if u are webmaster/webdesigner [in work with your clients] you need it :-) hope you understsand what i mean :-)

If the file is used to render a website, it can't be hidden from the user. The browser needs the source code itself to do the rendering, and so it can always display it to the user.

There is no binary file in HTML as there is with other programming languages.

You can make some files private, but that means that nobody except you can access the files. They can't be used to render a web page on someone else's computer..

Since most HTML code is a straightforward solution to the wanted layout, there is probably no intellectual property in the source code anyway.

If you want to HIDE proprietary code from the users, try developing the site in ASP or ASP.NET, but as MidiMagic stated, the HTML MUST be visible for the browser to interpret.

if you know any coding in css that would work to because all of your formating can be linked to an external style sheet that nobody knows the properties of.

commented: doesnt work, the style sheet is referenced in the header, 10s anybody has all your hidden css -1

Style sheets can be downloaded though. If you look in the <head> tags of any page on the site you can get the location of the CSS file. Once you know that all you have to do is put the path to that file in the address bar and it's yours.

you would have to need rights from your hosting server in order to download that style sheet.

<head>
<title><title>
<link rel="stylesheet" type="text/css"href="style.css" />
</head>


for the href it would be a host directory i dont thnk there would be any issues that would be one of the main reasons behind having an "external" style sheet

If the user doesn't have 'rights' to download the stylesheet then it wont affect any pages they view. if i read your <link rel="stylesheet" type="text/css"href="style.css" />, I know that 'style.css' is either in the same folder as the page, or at the very least the server will act as if it is. The browser needs to download that file in order to render the page, so if you protect the file (i.e. give it no public read access), the browser cannot download it, and thus cannot style the page. Of course, there are ways to slow down those people trying to 'steal your work', but, in general; it doesn't matter what convoluted route or server trickery you perform - if you put it on the web, and link to it ( in any way ), anyone who can see it can get it.

I never consider the protection of intellectual property as one of the main reasons for using an external stylesheet. Neither does anyone else.

you would have to need rights from your hosting server in order to download that style sheet.

<head>
<title><title>
<link rel="stylesheet" type="text/css"href="style.css" />
</head>


for the href it would be a host directory i dont thnk there would be any issues that would be one of the main reasons behind having an "external" style sheet

Lets take this forum for instance. I just right-clicked and did a "view source". From that source I quickly (I mean within 5 seconds) found this information <link rel="stylesheet" type="text/css" href="/forums/clientscript/vbulletin_css/style-c5d4bf1a-00008.css" id="vbulletin_css" />

Now, if I were to add that href link to the current domain (i.e. http://www.daniweb.com), I would have the css file, completely intact. I haven't found a site yet that locks up their css files. Actually, I don't think it can even be done.

Precisely Matt, nothing on the net is sacred.

I've always seen external style sheets as a way of providing multiple styles to a single page, or a single style to multiple pages.

They're great for blog skins or allowing your visitors to customize their version of your site, but I had never even looked at them as being a security device.

The CSS is downloaded too if you use the SAVE PAGE AS menu item on your browser. So is the JS.

Publishing the page while wanting to hide the code sounds like an oxymoron.

I still do not see a reason to want to hide the source code. I know plenty of people who have mentioned wanting to do this in the past and it's just silly.

You want the user to see the way the site looks, but not be able to see how you did it? Well, any fairly decent programmer can take a look at your site and recreate the basic layout of it in less than an hour, without using your code.

There is nothing that you can do in HTML that hasn't already been done, and probability says that you most likely learned those tricks by looking at what other people have done as well.

The only reason anyone would want to "hide" their code would be that they have visible text that they just don't want people copying, and they have already dissabled the copying of the text on the site. Again, anyone can just type that stuff out anyway. Besides, if you are going to be providing information to people, you should allow them to copy it to their hard drive so that they can reference it later.

I get urked by snopes.com because you can't copy their text, and the people that send me the emails that I look up are blocked from snopes at work.

If you are disabling right click all together, you will drive people away (I don't visit any sites with right click disabled).

The web is all about the user finding information and being able to use it.

That said, there are a few things that you can do to keep your proprietary stuff less available.

Use Java applets (not scripts, applets), use Flash, or burry everything amoung a mirriad of framess.
Sage

A couple points for you sage,

You want the user to see the way the site looks, but not be able to see how you did it? Well, any fairly decent programmer can take a look at your site and recreate the basic layout of it in less than an hour, without using your code.

Any fairly decent programmer wouldn't need to steal code, they would be able to produce it themselves without even having to think about how it should be done.

There is nothing that you can do in HTML that hasn't already been done, and probability says that you most likely learned those tricks by looking at what other people have done as well.

That's why faster and better languages are constantly being developed. Developers are titled that for a reason, they develop code which outputs greater amounts of HTML in shorter amounts of time. HTML is only the visual that we all see, which will soon be replaced by XML because it's even faster.

The only reason anyone would want to "hide" their code would be that they have visible text that they just don't want people copying, and they have already dissabled the copying of the text on the site. Again, anyone can just type that stuff out anyway. Besides, if you are going to be providing information to people, you should allow them to copy it to their hard drive so that they can reference it later.

I agree that people should be able to have access to the content of any page. Once it is put on the internet it is pretty much public domain anyways. If someone wants something they're going to take it. But, there is a BIG difference in the content I provide my readers and the code I use to present that content. If I didn't want my readers to know something, I wouldn't create the page that gives them that information. The point is HOW I give them that information. The code was created by me and is my code, nobody has a right to it but me.

Use Java applets (not scripts, applets), use Flash, or burry everything amoung a mirriad of framess.

I'm not too familiar with applets, but I understand they're more resource intensive than scripts, is that correct?

I've often thought about diving into Flash, but haven't found the need for it yet. That is definitely a way to prevent your info from being plagiarized.

Most likely can be sone with asp or php

There are some javascripts out there to be had that actually do this. You simply place a snipet of code in the body of your page, and you cannot right-click on the page and "view source". There has to be something out there that would do the same for the "View/Source" on the menus.

I use similar code for my "Trusted" image (only because I want to minimize the chance of the image itself being stolen), but you can still access the Source of the page without right-clicking.

View > Source works in IE7

you can just turn javascript off and steal the code

Robert,
Thanks for your input, I mean, I do understand where some people are coming from with wanting to keep their creations in their own hands, so that it can't be stolen by others. I do view web design/programming as an art form. I wouldn't like people steeling my music, or my websites.

That said, there is just so much one can do to try to hide their stuff, but the very nature of HTML is that it is not a compiled language, there is just no way to hide uncompiled languages.

To answer your question re: applets, actually, applets are more resource intensive, but scripts are also (by nature) noncompiled. Applets are compiled, theirfore, you can create content who's source can not be viewed. Flash is the same way.

The problem is, we don't really know what the questioner is trying to hide, if it's just his code in general, it's not gonna happen. You can try javascript, but I can turn it off on my end (since javascript is a client side language). You may be able to get away with it in something like ASP, which is server side, and possibly even JSP.

But here is the ULTIMATE reason as to why there is nothing you can do to hide your code.

Open up notepad, and go to "file, open".

In "file name", type http://www.google.com
Or use whichever site you want. You will notice that the code for that page will infact show up in your notepad. No need for a browser even. You can also go directly to certain pages on the site using the same technique.

I really didn't mean to sound like I was putting anyone down, in my first post here, and I'm sorry if it sounded that way.

Sage

No Problem Sage, I understand completely. As with anything, all anyone can really do is minimize the chance of their information from being stolen. If someone wants something bad enough they are going to take it.

That does make sense about the applets, now that I think about it, I did know they are compiled. That should have been a clue for me there. Thanks for the info.

i had the same problem.
thanks
cashu

<b> Well honestly, its gonna take work to hide your codes, you first need to understand CSS, and JS, when them two are together with in an html document, all you have to do is like the CSS, you make a JS file, within your page, refer back to it and boom, there is your "invisible data" :)

commented: doesnt work, the javascript file is referenced in the head, the thief just downloads the js file and has the code, it does add another layer, but n o more than 20s to bypass, every bit helps -1

One thing you *can* do, however, is to put some of the rendering code into a program that gets run before the web page is served. The code to draw the page still has to be available in the clear, but some of your content can be pulled up before becoming visible to the user.

For example, database code can be done via PHP or any of several other languages. All of the HTML is still visible to everybody, but the rest wouldn't be.

Why don't we all start bringing up three year old threads that have already been answered, and post inadequate replies that don't work.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.