Protect code/content by domain name
<p>I am writing a javascript product but it will be licensed to individual domain names. So in order to protect it from copy and pasted from the demo or from one site to another the code should only allow itself to run properly when it's on the right domain.</p>

<p>The encryption can be done server side by php when a user purchases the item and keys in the domain he wants to use it on. So it goes something like this:</p>

<pre><code>var encryptedtext = "My text here";
function decrypt(){
    //decrypt using domain name.
}
print( decrypt(encryptedtext) );
</code></pre>

<p>I don't need it to be strong. The product will cost only a few dollars and the protection should be enough to demotivate any cracking.</p>

<p>The biggest weakness I find is it is very obvious that it's taking the domain name as the decryption key. What would be the best way to mitigate this?</p>
