Block view source

How can i block people from right click view source? Is this a hard or expensive thing to do?

You can’t! Why would you even want to?

ive seen some website’s were you right click and either nothing pops up or you cant view source or you cant save images.

I would only want to so my competition cant see into it. but its no big deal only a question

You can disable right-click. But that will not stop anyone from viewing the source.

Instead of doing that, if your worried about it, why not concatenate and minify your files? You should be doing that anyways for performance reasons.

You cant worry about hiding HTML code, that’s not important and PHP will not show up, so if there is some content you need to block, for example the location of a file, that you don’t want people to find out, why don’t you encode your PHP results or use cookies, etc… There are many tricks you can do.

What is it that you don’t want them to see exactly?

Browsers have options to disallow blocking the right mouse button and context menu.

Even with those blocked you can still use the option from the main menu bar.

Even if the entire page is in an iframe so that the main menu option just displays the empty wrapper page and the HTML of the actual page is obfuscated you can still use a single line of JavaScript to view the source of the page.

The single line of JavaScript will bypass any obfuscation - including that applied by software that scammers sell for $300 and more.

:lol: A bit like asking “And just how much money are you now carrying in this dark deserted alleyway?”

Anyway, as others have said, there isn’t much you can do from a technical perspective, though you should put sensitive info outside of the public root if anywhere. True, PHP files shouldn’t be accessible - as long as the PHP engine is working. Having them outside of the public root prevents them from being accessible if it isn’t.

Unfortunately the best way is to take legal precautions - which for many is cost prohibitive. If it’s online and someone wants it they can get it. You can do things like “no right-click” and write hard to read mark-up, and might be able to deter some, but doing so would probably be seen as a challenge and entice others to find out what you’re trying to hide.

[FONT=Verdana]As well as being intensely irritating for people who are using right-click for other reasons. When I try to call up the context menu and find someone has blocked right-clicking, if I’m in that frame of mind I might go out of my way to try to sabotage their paranoid but futile efforts.

If people are determined enough, you can’t stop them viewing the source code, so don’t waste your time and other people’s by trying![/FONT]

If you are that worried about competition stealing something from you, can’t you just check up on your competition to make sure that none of that happens? Or are you afraid they will steal general ideas?

It’s a legitimate question.

But I don’t see what you can possibly have in a an HTML markup code, a CSS style code or in a JavaScript scripting code worth stealing.

You should also consider that as a counter to your possible$ worth protection software there is always a 0$ worth copy program like httrack that will just copy your entire site for offline use, no questions asked (including no right click necessary).

If it’s about content, think about e-books, games, music, movies, tv shows. If it were possible, I’m sure that the money the companies behind that can front for such a solution are way above your top limit. Yet, there is no one to sell it. Their efforts are more about losing money coming up with protections that are hacked in matter of days.

The only thing you can do is to seek justice in courts against those that profit from your intellectual propriety in an illegal way.

Disabling right click is a JavaScript solution. A simple action like disabling JavaScript in your browser and that “protection” is gone.

Other cheaper solutions are those that always look to constrain the amount of content a user can see at a given time. Like, for example, you only put a part of the song, for preview. Or only a few pages at one time, not the whole book. Those have also the purpose of giving the user a taste, as to convince him it’s worth buying.

Its fine i really dont have anything worth stealing lol. Idk i guess i didnt want people seeing what i do seo wise. I already took out keyword meta since it doesnt even help seo.

Im not very good with code or anything. I learned how to build a simple website and thought i was a website designer lol. Im more of a business man

LOL i like your analogy, but i swear my intent was not to mug someone. The thing is sometimes like “website_designer” said, he just wanted to hide SEO tricks and i want to know more about it before giving some one fair advise, so

@website_designer you cant hide what you want search engines to find
, there fore, impossible my friend. Also SEO is not a trick any more, is not like it was before, you need to create a name for yourself.

Yeah. That’s actually a really good idea :lol: I’ll give you an example of this. Once upon a time, there was certain software on my computer that someone else put on (not a virus, it was consensual) my computer that I was determined to get around. It was really a simple matter, really - I was going to disable the process in Task Manager and also in Sysinternal’s Process Explorer (more effective than just Task Manager). It was on my home computer that I had built - no one had had any hand it any of it, etc. When I went to do it, I found that I couldn’t. Fine. I had admin privelages, so I just ran Process Explorer as admin. It worked like a charm…but then it came back! I then thought taht it must be something to do w/ the Process Tree. Fine. I killed the Process Tree, but it still came back. Alright - just a bit of a challenge. I opened up another program that should have done the trick. I ran it as admin (keep in mind that this is my own computer) but it denied me access. And I was absolutely furious. While that was a long and somewhat pointless story, here’s the moral: when you take people’s freedoms away from them, they get ticked and still find a way around it (I found a way around it, eventually). Don’t do it because it’s pointless, especially to technologically-advanced and persistent people.

Yeah. I agree with that. Think about software piracy - these are multi-million dollar (in some cases, multi-billion dollar!) companies who are looking to stop people from taking their software. And what happens? There’s usually some crack or keygen or other shady software out after a week. When people get determined, there’s little to stop them.


There are too many tools around to let uses view HTML source code - Firebug, Built in View Source, IEs and Chromes developer toolsbars - if I really wanted to see the code behind a html page, I’ve got ‘wget’ from a Linux command line.

In otherwords, its pointless trying to stop it.

On the web you’ll actually be in a better position if you freely give out what you know.

You’re on a site that is built because people want to share their knowledge and help those new to it.
Most SEO techniques are crap anyway and not worth spending time on, just learn how to build well structured pages and get good content/back links.

I wish i could CLOSE this thread. No offense to anyone.

We’re not trying to offend you - just being straight up.


Note: You can always pm any of the staff if you want a thread specifically closed.

Ahh its cool. I do understand glad everyone is being straight up with me.

A much easier way is to click the flag next to your post and say you want the thread closed.

Point noted. :wink: