开发者

If url not equals to specific url then add condition [closed]

开发者 https://www.devze.com 2023-04-10 07:29 出处:网络
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical andcannot be reasonably answered in its current form. For help clari
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 11 years ago.

I am a template designer and I have some purchasable templates, but more often than not I fin开发者_JAVA技巧d people share my template and redistributing them for free. so I would like a Javascript/jQuery to write that if the current url is not equal to specified url (var url = blogurlhere) then hide or remove <body> to prevent people from copying my templates. Please, I really appreciate it.


I'd suggest:

$(function() {
    var legitimate_url = 'http://blogurlhere.com';
    if ((document.location != legitimate_url) && (Math.floor(Math.random()*111) == 1)) {
        document.location = 'http://yoursite.com/stolen';
    }
});

Where http://yoursite.com/stolen displays the most embarassing message ever. Which will happen once in 100 times or so.

Base64encode that and put it into eval() and base64decode() respectively.

But frankly, that'll only keep the most stupid of people from "stealing" your stuff. There's not a whole lot that you can do against "piracy" of that kind.

Edit:

Depending on what system(s) you are developing your templates for, you could implement some additional server side layer of security:

For example, some (rather expensive) WordPress templates I have come across pull vital bits of their functionality from a remote server. The code responsible is somewhat obfuscated (though, again, it's obviously not impossible to decode for someone who knows their bits and bytes, thus enabling the person to simply pull the stuff in question from your server).

Also, well-buried killswitches are quite common in expensive Magento extensions. Basically, the underlying PHP polls the developers' server now and then, transmitting the domain it's being run on. This information is then matched against a license database - if no match is detected, the extension deletes a couple of its files and leaves a rather unfriendly message for the admin.


If – since you've been asking for a client-side solution, I assume this is the case – you're shipping somewhat pure HTML/CSS/JS to your customers, you're basically out of luck as far as technical solutions are concerned. Everything that happens client-side can (and therefor will) be circumvented by even moderately knowledgeable adversaries.

The best thing you can do in this case, is to offer "the pirates" incentives to legalize what they have "stolen" from you, i.e. by

  • offering a discount on another theme of yours
  • providing an hour or two of "free" customization support
  • offering access to a "premium support" forum
  • offering next day response on inquiries

… for those with a valid receipt number.

tl;dr: Some of the world's biggest companies (and industries) have constantly failed at protecting their stuff from "piracy". It is pretty unlikely that you will do any better. Give the customer a reason to buy from you rather than stealing. Or make your themes free in the first place and sell corresponding services.


I believe you use window.location for this.

$(function() { if (window.location != 'http://www.template.com') { $(body).html(''); } });

Insert it on a hidden place. May I suggest somewhere in the jquery file? Noone would bother browsing through that file :)


Nothing will be 100% safe, but you might want to obfuscate your HTML for a bit of extra protection. Searching for HTML obfuscator on Google should help. There are plenty of code scramblers online. You could also make your templates in just JavaScript/jQuery and obfuscate that. It looks very scary for people with basic knowledge, but like others are saying, you can't protect against ripping in JavaScript alone.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号