SitePoint Sponsor

User Tag List

Results 1 to 22 of 22
  1. #1
    SitePoint Enthusiast
    Join Date
    Dec 2008
    Posts
    76
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Block view source

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

  2. #2
    SitePoint Guru bronze trophy TheRaptor's Avatar
    Join Date
    Jul 2011
    Location
    New York
    Posts
    710
    Mentioned
    40 Post(s)
    Tagged
    0 Thread(s)
    You can't! Why would you even want to?
    TheRaptor - Joe

  3. #3
    SitePoint Enthusiast
    Join Date
    Dec 2008
    Posts
    76
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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

  4. #4
    SitePoint Guru bronze trophy TheRaptor's Avatar
    Join Date
    Jul 2011
    Location
    New York
    Posts
    710
    Mentioned
    40 Post(s)
    Tagged
    0 Thread(s)
    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.
    TheRaptor - Joe

  5. #5
    SitePoint Member
    Join Date
    Mar 2012
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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?

  6. #6
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,810
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    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.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  7. #7
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,154
    Mentioned
    190 Post(s)
    Tagged
    2 Thread(s)
    Quote Originally Posted by sandiegotech.net View Post
    What is it that you don't want them to see exactly?
    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.

  8. #8
    Mouse catcher silver trophy Stevie D's Avatar
    Join Date
    Mar 2006
    Location
    Yorkshire, UK
    Posts
    5,888
    Mentioned
    122 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by Mittineague View Post
    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.
    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!

  9. #9
    billycundiff{float:left;} silver trophybronze trophy RyanReese's Avatar
    Join Date
    Oct 2008
    Location
    Whiteford, Maryland, United States
    Posts
    13,587
    Mentioned
    6 Post(s)
    Tagged
    0 Thread(s)
    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?
    Twitter-@Ryan_Reese09
    http://www.ryanreese.us -Always looking for web design/development work

  10. #10
    Non-Member
    Join Date
    Feb 2012
    Posts
    892
    Mentioned
    10 Post(s)
    Tagged
    0 Thread(s)
    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 x.xxx$ 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.

  11. #11
    SitePoint Enthusiast
    Join Date
    Dec 2008
    Posts
    76
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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

  12. #12
    SitePoint Member
    Join Date
    Mar 2012
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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.

  13. #13
    <title class="lol"> bronze trophy TehYoyo's Avatar
    Join Date
    Feb 2012
    Location
    Northeast Chicago Suburbs
    Posts
    806
    Mentioned
    18 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by Stevie D View Post
    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.
    Yeah. That's actually a really good idea 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.

    Quote Originally Posted by Stevie D View Post
    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!
    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.

    ~TehYoyo

  14. #14
    Twitter: @TimIgoe silver trophy TimIgoe's Avatar
    Join Date
    Feb 2005
    Location
    Blackpool, UK
    Posts
    1,056
    Mentioned
    27 Post(s)
    Tagged
    1 Thread(s)
    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.

  15. #15
    padawan silver trophybronze trophy markbrown4's Avatar
    Join Date
    Jul 2006
    Location
    Victoria, Australia
    Posts
    4,108
    Mentioned
    28 Post(s)
    Tagged
    2 Thread(s)
    Quote Originally Posted by website_designer View Post
    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
    On the web you'll actually be in a better position if you freely give out what you know.
    http://gettingreal.37signals.com/ch1..._Education.php

    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.

  16. #16
    SitePoint Enthusiast
    Join Date
    Dec 2008
    Posts
    76
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I wish i could CLOSE this thread. No offense to anyone.

  17. #17
    <title class="lol"> bronze trophy TehYoyo's Avatar
    Join Date
    Feb 2012
    Location
    Northeast Chicago Suburbs
    Posts
    806
    Mentioned
    18 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by website_designer View Post
    I wish i could CLOSE this thread. No offense to anyone.
    We're not trying to offend you - just being straight up.

    ~TehYoyo

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

  18. #18
    SitePoint Enthusiast
    Join Date
    Dec 2008
    Posts
    76
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by TehYoyo View Post
    We're not trying to offend you - just being straight up.

    ~TehYoyo

    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.

  19. #19
    Life is not a malfunction gold trophysilver trophybronze trophy
    TechnoBear's Avatar
    Join Date
    Jun 2011
    Location
    Argyll, Scotland
    Posts
    6,164
    Mentioned
    264 Post(s)
    Tagged
    5 Thread(s)
    Quote Originally Posted by TehYoyo View Post
    Note: You can always pm any of the staff if you want a thread specifically closed.
    A much easier way is to click the flag next to your post and say you want the thread closed.

  20. #20
    <title class="lol"> bronze trophy TehYoyo's Avatar
    Join Date
    Feb 2012
    Location
    Northeast Chicago Suburbs
    Posts
    806
    Mentioned
    18 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by TechnoBear View Post
    A much easier way is to click the flag next to your post and say you want the thread closed.
    Point noted.

  21. #21
    SitePoint Zealot
    Join Date
    Mar 2012
    Posts
    110
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by website_designer View Post
    Its fine i really dont have anything worth stealing lol. Idk i guess i didnt want people seeing what i do seo wise.
    As it has already been established that disabling others from seeing the source isn't possible (without actually hacking each of your visitor's computers! ), perhaps you can try some kind of counter-intelligence.

    For instance, maybe putting stuff in your code that is meaningless to SEO but under the guise that it is there for SEO just to throw off anyone you're worried about... but on the other hand, this in of itself may prove counter-productive for SEO .

  22. #22
    SitePoint Member
    Join Date
    Apr 2012
    Posts
    14
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You can find a plethora of methods to do this via google, but to be honest it's all in vain, if a user wants to see your website source bad enough, they're going to see it trying to block right clicks will just annoy them at best, even firefox has a simple tools->webdev->page source option. If you want to further annoy them you can encode your source like google does though, but that again won't stop the determined users.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •