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.
jamshid
Junior Poster in Training
70 posts since Jan 2006
Reputation Points: 8
Solved Threads: 0
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.
MattEvans
Veteran Poster
1,386 posts since Jul 2006
Reputation Points: 522
Solved Threads: 64
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.
MidiMagic
Nearly a Senior Poster
3,319 posts since Jan 2007
Reputation Points: 730
Solved Threads: 182
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.
MidiMagic
Nearly a Senior Poster
3,319 posts since Jan 2007
Reputation Points: 730
Solved Threads: 182
If the user doesn't have 'rights' to download the stylesheet then it wont affect any pages they view. if i read your , 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.
MattEvans
Veteran Poster
1,386 posts since Jul 2006
Reputation Points: 522
Solved Threads: 64
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.
MidiMagic
Nearly a Senior Poster
3,319 posts since Jan 2007
Reputation Points: 730
Solved Threads: 182
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
sagedavis
Junior Poster in Training
86 posts since Nov 2007
Reputation Points: 10
Solved Threads: 6