SitePoint Sponsor

User Tag List

Results 1 to 18 of 18
  1. #1
    SitePoint Enthusiast webmasts's Avatar
    Join Date
    Apr 2003
    Location
    usa
    Posts
    75
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Smile how to disable 'view source'

    Is there anyways that you can disable the "View Source" in your browser with PHP?

    Thankx

  2. #2
    SitePoint Wizard
    Join Date
    Mar 2002
    Location
    Bristol, UK
    Posts
    2,240
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Nope

    Although I saw an interesting page once where the source had been encrypted somehow (no it wasn't just the javascript encryption, something much more advanced). I'll see if I can find the URL for you.

    -Sam
    Sam Hastings

  3. #3
    ********* Member website's Avatar
    Join Date
    Oct 2002
    Location
    Iceland
    Posts
    1,238
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    if you do, I'll shoot you.

    but anyhow, don't do it it will only annoy people but serve no good. The most frequent way is to use javascript to ban right click etc and that is just bad because it like I said annoys people and those who want to get the source are able to do it.

    The browser must receive the html and be able to read it, disabling view source will never work, you can always get around it.
    - website

  4. #4
    Resistance is Futile webgodjj's Avatar
    Join Date
    Nov 2002
    Location
    Madison, WI USA
    Posts
    448
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The real question is why? If it's just html and javascript.. believe me, it's not that secret. If it's PHP, you can't view the source in the browser because it's parsed by the server.

  5. #5
    SitePoint Wizard samsm's Avatar
    Join Date
    Nov 2001
    Location
    Atlanta, GA, USA
    Posts
    5,011
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Read about disabling source in this thread.

    Seconding what everyone else is saying, disabling source will not be effective and therefore not worth your time. If you go so far as to disable right clicking (which also won't always work) you'll likely step on the toes of your users.
    Last edited by samsm; Apr 29, 2003 at 17:12.
    Using your unpaid time to add free content to SitePoint Pty Ltd's portfolio?

  6. #6
    Non-Member
    Join Date
    Jan 2003
    Posts
    5,748
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    And you don't want to mess your user's around, right ?

    I find the who idea of trying to hide the source a complete waste of time anyway since the document is cached on the user's machine anyway is it not ?

    Completely pointless and redundant IMO 8)

  7. #7
    ********* Member website's Avatar
    Join Date
    Oct 2002
    Location
    Iceland
    Posts
    1,238
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    and to crack all protections and javascript **** you could just get some bad browser that doesn't support all this, then you could see the code... very simple.
    - website

  8. #8
    ********* Genius Mike's Avatar
    Join Date
    Apr 2001
    Location
    Canada
    Posts
    5,458
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    HTML is HTML, there are no top secret ways of doing it. Hiding your source code will lead to the funny hackers DDoS'ing your site and torturing you.

    Not that I know.
    Mike
    It's not who I am underneath, but what I do that defines me.

  9. #9
    ********* Member website's Avatar
    Join Date
    Oct 2002
    Location
    Iceland
    Posts
    1,238
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    exacly, if the browser can see the HTML, the user can see it! so if you want the browser to display your site, you must send the html. There is abselutely no way around this.
    - website

  10. #10
    ********* Member website's Avatar
    Join Date
    Oct 2002
    Location
    Iceland
    Posts
    1,238
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    1 thing though, you could design your site fully with css and seperate the css into many files so it will be so complicated on one will bother to work it out. Sitepoint is like that and I gave up
    - website

  11. #11
    SitePoint Enthusiast
    Join Date
    Jan 2003
    Location
    Dallas, Texas
    Posts
    86
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Even if you diable right click they can always just go to View > Source

    There's no getting around it...

  12. #12
    SitePoint Wizard
    Join Date
    Nov 2000
    Location
    Chico, Ca
    Posts
    1,125
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Unless you are a top secret government organization working on a high level project you don't need to hide your source.

    If you don't want people to view your source don't put it on the internet.
    "Happiness doesn't find you, you find happiness" -- Unknown
    www.chuckknows.com

  13. #13
    Currently Occupied; Till Sunda Andrew-J2000's Avatar
    Join Date
    Aug 2001
    Location
    London
    Posts
    2,475
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Chuckie
    If you don't want people to view your source don't put it on the internet.
    I was about to write the very same thing

  14. #14
    SitePoint Zealot Egghead's Avatar
    Join Date
    Feb 2002
    Posts
    197
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You could always post your source code here and everyone will let you know if you should hide it or not!

  15. #15
    SitePoint Member insomica's Avatar
    Join Date
    Apr 2003
    Location
    Houston, TX
    Posts
    24
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    haha thats funny
    BitWise Sreen Name - insomica
    File Size of Bitwise is only 595k.
    They are working on version for linux.
    http://www.schwippy.com/insomica/


  16. #16
    SitePoint Zealot webQS's Avatar
    Join Date
    Oct 2002
    Location
    Sydney : Australia
    Posts
    144
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hey

    I once was asked to test a site, so I browsed it with IE and went to view the source wiht right click... alert box "you can't do that" or something like that....

    It's just too user abusive to have something like that because the right click menu has lots more intuitive things other than "View Source". If someone banned the right menu on a site in Mozilla I'd be unhappy because the with right click one can open pages in new tabs etc.

    So I used Mozilla to test the site and viewed the source from there... because the right click handler only worked for IE/Win....

    Don't bother, it's a waste of development time as someone will always get around it (like viewing the source in the Google cache or using the wayback machine).

    Cheers
    James

  17. #17
    if($awake){code();} PHP John's Avatar
    Join Date
    Jul 2002
    Location
    Along the Wasatch Fault line.
    Posts
    1,771
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Does that answer your question?
    John

  18. #18
    "Of" != "Have" bronze trophy Jeff Lange's Avatar
    Join Date
    Jan 2003
    Location
    Calgary, Canada
    Posts
    2,063
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Or, you can always go to a site like validator.w3.org, and view the source that way, or download it using PHP and view it...

    It is impossible to hide the source, don't even try, it's just annoying and makes your site look unprofessional (no matter how professionally developed it is)
    Who walks the stairs without a care
    It shoots so high in the sky.
    Bounce up and down just like a clown.
    Everyone knows its Slinky.


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
  •