Is there a way for me to prevent other websites from copying my JavaScript code? Recently I noticed that another website has copied my JavaScript code from my website [PNRStatus.info ]. The code has been copied as-is along with comments.
Fotiman
4:04 pm on Jan 10, 2011 (gmt 0)
No, JavaScript is processed in the client browser, so there's no way to prevent your code from being copied.
topr8
4:04 pm on Jan 10, 2011 (gmt 0)
welcome to WebmasterWorld
you can't prevent it, you can take legal action, but that's most likely pointless.
you can also obscure your code as much as possible, but ultimately can't stop copying.
have you really produced javascript that is so unique and clever that you need to protect it?
ps. personal links aren't allowed here, you might want to edit it out.
PatrickDey
7:05 pm on Jan 10, 2011 (gmt 0)
Thanks Fotiman and topr8. I tried to edit the link out of my post. However I get the messsage, "Allowable time to edit post has past."
SteveWh
3:03 pm on Jan 11, 2011 (gmt 0)
I'd suggest putting a copyright notice in the code as a comment. Also include the URL of your website. If the thieves don't edit them out (many don't bother), at least others who see the code will know where it came from.
If it's going to be stolen anyway, you might consider licensing the code under the GNU GPL, and adding the appropriate notice to that effect. The point of that is that people might be more inclined to retain your copyright notice (and treat the code with more respect) when they see the GPL license. They know you won't go after them for infringement, so no point in removing your copyright. So even if the code gets copied, it can help promote you and your website.
Your copyright notice (when it's not deleted) might also help you track which sites have copied your code, using web searches on it.