1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Protect CSS by calling it with javascript

Discussion in 'CSS' started by kyle422, Mar 25, 2005.

  1. #1
    I found this site in search for a way to protect your CSS http:// maratz. com/blog/archives/2004/07/24/script-theft/
    I have been trying to figure out how he did this. I have never seen it done and have searched high and low for a way to impliment it. There is no way that I can see to get his CSS. I think it's a great way to protect your design.
    Does anyone know all the steps to make this work?
     
    kyle422, Mar 25, 2005 IP
  2. nullbit

    nullbit Peon

    Messages:
    489
    Likes Received:
    19
    Best Answers:
    0
    Trophy Points:
    0
    #2
    It seems like a really bad idea to me:

    1. Anyone with the referrer header blanked or disabled gets un-styled content
    2. He's using server side code (PHP) not JavaScript - if you used JavaScript those with it disabled would see un-styled content
    3. It doesn't prevent anyone stealing your CSS, only hot-linking it, and people hot-linking CSS is rare anyway, so far as I know.
     
    nullbit, Mar 25, 2005 IP
  3. kyle422

    kyle422 Peon

    Messages:
    290
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #3
    That doesn't seem like a big deal, they still will see the content.
    Same response as above.
    Try to view his CSS. I really don't think you can. If you try you only get his page that says "thank you for being interested in my work", with a link that brings you to the URL in my original post. It's funny, because it seems most people have the same opinions as you, but this guy really has done something to protect his work. I'm sure a script kitty would be able to get the CSS and maybe preventing people from viewing your CSS may actually bring those types of people to your site to break your "code". I've seen people trying to hide their html with encryption software (easy to decrypt).
    Hotlinking would be easiely tracable, and I agree that wouldn't be a concern, but please take another look at how this guy protected his work.
    disclaimer: I am interested in how he did it, not how to steal it. :)
     
    kyle422, Mar 25, 2005 IP
  4. J.D.

    J.D. Peon

    Messages:
    1,198
    Likes Received:
    65
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Techniques like these are a waste of time (your time, that is). Hit File > Save As in your browser and get all his stylesheets and JS files. The only way to prevent people from getting any of this stuff is not to publish it :)

    One thing you can do, though, to make it harder for somebody to use your stylesheets and scripts - you can obfuscation tools on your files before publishing them. These tools change your source so that it's harder to understand what it does for a human. For example, it will change this

    function rotateImage(img)
    {
    // get next image
    img.src = imgarr.nextImage();
    }

    into this

    function f1(p1){img.src=v1.f2();}

    , making it smaller to serve and harder to understand.

    J.D.
     
    J.D., Mar 25, 2005 IP
  5. nullbit

    nullbit Peon

    Messages:
    489
    Likes Received:
    19
    Best Answers:
    0
    Trophy Points:
    0
    #5
    His CSS:

    [ Removed by myself ]

    Edit: I posted this code to prove a point, I will remove it shortly, before I get a DMCA of the guy.
     
    nullbit, Mar 25, 2005 IP
  6. J.D.

    J.D. Peon

    Messages:
    1,198
    Likes Received:
    65
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Use attachments, otherwise you might not be able to change your post after a while.
     
    J.D., Mar 25, 2005 IP
  7. kyle422

    kyle422 Peon

    Messages:
    290
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Your proved me wrong. Thanks, now I won't waste my time figuring out how to protect it. :)
     
    kyle422, Mar 25, 2005 IP
  8. nullbit

    nullbit Peon

    Messages:
    489
    Likes Received:
    19
    Best Answers:
    0
    Trophy Points:
    0
    #8
    I don't think you're totally wasting your time, but I think J.D's advice of making the code less human readable is the better option than trying to restrict access.
     
    nullbit, Mar 25, 2005 IP
  9. kyle422

    kyle422 Peon

    Messages:
    290
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #9
    That makes sense. Thanks for the help guys! or girls! :D
     
    kyle422, Mar 25, 2005 IP
  10. J.D.

    J.D. Peon

    Messages:
    1,198
    Likes Received:
    65
    Best Answers:
    0
    Trophy Points:
    0
    #10
    Hmm... that explains the Zapp Brannigan avatar :D
     
    J.D., Mar 25, 2005 IP
  11. kyle422

    kyle422 Peon

    Messages:
    290
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #11
    LOL. Too funny.
     
    kyle422, Mar 25, 2005 IP