The SitePoint Forums have moved.

You can now find them here.
This forum is now closed to new posts, but you can browse existing content.
You can find out more information about the move and how to open a new account (if necessary) here.
If you get stuck you can get support by emailing forums@sitepoint.com

If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

How do I hide the source to my page? I dont like the no right-click scripts, because they are disturbing to the viewers. Does anyone have a script or anything to keep people from seeing the source to my web page?

The only true way to do that is not to put the page up. No matter what, your source is viewable. Try a no right click script? No problem. Try massive amounts of whitespace? No problem. Try removing the toolbar? No problem. Between holding the mouse button down and hitting enter to get rid of the no right click script, scrolling down the source, or using the context key (on Windows keyboards), your source can be read. The real quesiton is why on earth would you feel the need to hide your source anyway?

I must be frank and say i simply do not use right click when i want to look at the source of a page. This is because when i first used IE i dont think the source option was available on the right click toolbar! And for all those true nerds out there im sure you can sympathise with the automatic muscle movements thing :-)

Yeah I hate to say it but I really laughed the first time I saw a page with no right click. I use right click to copy and paste text. I think I highlighted some text and click up comes a little window. So I had to copy and paste from the edit menu.

I almost put an image one on my site for the 3d artwork images I created, but really, all a person would have to do is look at my source then call the graphic directly from the browser address bar.

I just put a big copyright notice saying that my 3d images were copyrighted and may not be used for commercial use.

I don't care if they want to use it as a wallpaper etc. Just leave my copyright in the pic alone (give me credits) And if I see it in a commercial package or I see someone making $$$ off my work, then I will see a lawyer.

I also think that trying to hide code, even if it did work, doesn't really work in the end. Most webpage designers that are worth their salt could duplicate a site without seeing any of the code. Just on looks and layout alone.

Anyway Euphonium, with all this said you should ask your question again on the client side scriping forum as this is really the wrong forum for this thread.

I agree with those posts that suggest you don't post your page/s to the web. Really!

Firstly, the internet and the www would not exist if everyone went around keeping their source code a guarded secret. The sciences would probably be 10 years behind where they are now - after all the public internet was developed for scientists by scientists to share knowledge. Those of us outside of universities and labs would be paying through the but-hole by the hour to view a closed proprietory form of the www - remember e-world, the original msn and aol?

The reason you can publish your pages on the www in the first place is because greater minds have collaborated to develop the standards and then give them to the world for free.

While I do very little web publishing myself, 90% of what I knowledge I do have I have gained from the generous contributions of people I'll never meet or know, from tutorial style web sites, usenet and forums such as this. I would not be able to program in the few languages that I do without newsgroups like comp.lang.c++ where I can post my code anytime and have phd brains from around the world debug and critique it while I'm sleeping!

If you want to hide your source code then don't publish on the word-wide-web - its not the right medium for you to grok. Print a pretty brochure or buy a page of advertising in a magazine or something.

Don't you think it a little hypocritical to be asking others to fhelp you with your code for free when you are not prepared to share it yourself?

Secondly, do you really want to screw the usability of your site by hiding the browser window navigation tool bar? Here is what Jakob Nielson http://www.useit.com (love him or hate hime) has to say about breaking the browser back-button. He rates it the number one killer of site usability ("Alertbox" May 30 ,1999) http://www.useit.com/alertbox/990530.html

1. Breaking or Slowing Down the Back Button
The Back button is the lifeline of the Web user and the second-most used navigation feature (after following hypertext links). Users happily know that they can try anything on the Web and always be saved by a click or two on Back to return them to familiar territory.

Except, of course, for those sites that break Back by committing one of these design sins:

* opening a new browser window (see mistake #2)
* using an immediate redirect: every time the user clicks Back, the browser returns to a page that bounces the user forward to the undesired location
* prevents caching such that the Back navigation requires a fresh trip to the server; all hypertext navigation should be sub-second and this goes double for backtracking

This can *somewhat* be done with a script that changes the code to something that is harder to read, but it surely won't 'hide' it. I wouldn't use it for a number of reasons, thus there is no sense in explaining it much further.

If you want to hide code of a script you made and offer for sale, contact me. Otherwise, this isn't something you'd want to use.

Originally posted by CryingWolf Yeah it is a pretty bad thing to break a browser!!! I hate popups that popup automaticly!!! These things will keep me from ever visiting their site again!!!

I agree. I immediately close any pop up window. I don't care what's in it. And when I get to a site that has some useless flash entrance i click on "skip intro" straight away or "non-flash version" if its offered. If I want to watch a cartoon I'll sit infront of the television.

If you really want to be greedy with you code, just take out all the white space and break the lines at like 500 characters, it makes it VERY difficult to read the code, what do you have to hide anyways? The people can see what the code produces on their page, or save the page and edit it with a wysiwyg editor, there's a million ways around hiding the code, or no right click scripts (which i despise) because I use right click to open links in a new window. I wont even go to sites that disable it. :P

I hate right click scripts, cause I right click to hit "Open in new window" and "Back", plus you can get to the source a thousand other ways.

There is no way to hide your source...and if you are using and trying to hide your HTML, you are most likely a newbie and the visitors to your site are most likely newbies that wont try to steal your code.

Anywho, try this. It can be easily broken with a script you write, but most people wont go though that effort. Plus the code looks very intimidating unless you are a programmer.

Thanks for the tip Chris - I'll have to give that a try. Many times I've wanted to open a link in a new window, and I've always done so by right-clicking, so I wouldn't have to leave the mouse and make the tortorous journey to the keyboard.

Dear Euphonium, dear group....I sympathize with both aspects of the problem, as on one side I am learning quite a lot from all the good code I find on all those award sites. On the other hand, I do understand security issues, as I work for a bank (you can check the scripts at http://www.corner.ch) and our main concern "over here" is that we don't want someone to hack off our pages and use them for some illicit purpose. So basically the salomonic verdict would read: "If thou needst security, then thou shall write a script and therefore hide your sins, otherwise thou shall leave your code free for all humankind to peruse!"
Peace everybody and keep up the good job!
JingleJungle