The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Hideing index.html and CSS Sheets w/ Javascript? Re: Hideing index.html and CSS Sheets w/ Javascript?


I had no problems viewing the source code or CSS for that site (perhaps you meant a specific section?), but to answer your question — it’s possible to disable right-clicking with Javascript (so the “View Source” or “Inspect Element” options are not directly available), however I would advise against that.

First, you’re taking away a default browser functionality from the user. I believe that’s something you should never do.
Second, even if you do, a user can simply disable Javascript and bypass it anyway. If someone wants the source code, they can get it one way or another. Even by selecting “View Source” from the top menu.