2

So I wrote some php code to check the URL of the current site then compare it to the URL it should be located at and to e-mail me if somebody copy pasted my code and used it on there own site. Then I hit my head against my desk realizing that the PHP would be executed on the server and potential thieves would never even see that code.

So I keep trying to think of ways to stop a simple full copy paste of my website. Is it possible to do that sort of thing in java script or something that would inform me if my website was stolen or make it break if it was.

Joel
  • 587
  • 1
  • 5
  • 17
  • Perhaps something that googles for full sentences on your website? Seems a bit paranoid though, usually full copy pastes are only done for caching or things like thewaybackmachine. – Arend Jun 19 '11 at 17:48
  • Are you certain that someone would actually want to "steal your site"? – Wesley Murch Jun 19 '11 at 17:51
  • If you want to protect your source code, do not host websites on clients' servers. – Ondřej Mirtes Jun 19 '11 at 17:52
  • 1
    Just make your site in FrontPage or Dreamweaver, then no one will ever want to steal your HTML source code :) – Wesley Murch Jun 19 '11 at 17:55

5 Answers5

3

So I keep trying to think of ways to stop a simple full copy paste of my website

The short and long of it is that it's impossible. If your web site contains a specific design, it is protected by law. You may be able to fight blatant rip-offs through legal means.

Other than that, there's no reliable way to protect HTML source code.

Pekka
  • 442,112
  • 142
  • 972
  • 1,088
2

You can obfuscate Javacscript to make if more difficult to understand but even this is possible to disentangle and reuse. You can try the same techniques in HTML but again these are not impossible to reverse.

Community
  • 1
  • 1
Andy
  • 17,423
  • 9
  • 52
  • 69
2

You could check the domain name via document.domain in Javascript, and if it doesn't match your domain, make an AJAX request to your server to send an email.

Make sure you obfuscate the code through uglify, minify, etc.

This would protect it from newbies copying your pages without reading the code, whereas decent programmers would be able to figure it out and remove it.

Chris
  • 4,594
  • 4
  • 29
  • 39
  • Haha, maybe. If it does the job, why not? – Chris Jun 19 '11 at 18:00
  • Sounds good, i've got var url = document.domain; to get the domain but i've never used AJAX before and know little javascript. How do you use the if statement and send the e-mail? – Joel Jun 19 '11 at 23:55
1

This is not really possible. You can verify HTML and Javascript on other websites but unless you are google, your server will never be able compare your websites's Html or JS with other website.

Just warn people in your code that using your code could lead them to a law suit.

Jean-Philippe Leclerc
  • 6,713
  • 5
  • 43
  • 66
1

You could add an invisible image to your code (. If the person copying your code is stupid enough not to check for this, request for this image for the other persons site will show up in you log with the refferer set to the other persons page url.

Gerben
  • 16,747
  • 6
  • 37
  • 56