Method to prevent code piracy

Today, I came across an amazing piece of code. It was to prevent the piracy of website. Though, I was assign to crack it, I loved that piece of code.

In software development, there are two type of people. One who support the open-source technologies and another who don’t want their code to be share. Both of them have their own merits and demerits.

Recently, open-source is the new standard of coding. People share their code to community and ask them to contribute and improve the piece of code, add features and make the project great.

On the other site, there are few people who thinks, why I would share my piece of code? It is my baby. And people don’t share their baby with others right? Today, I came across same baby.

Guy who wanted to prevent the piracy, checked for the host name of URL. If it didn’t match with the actual host name. He removed all the classes and id from each element of DOM. This way look and feel of the site will change.

He added this code to the obfuscate foundation file, which has more than 1000 line of code and shipped it.

This was its way to stop piracy. Do you write such code to stop piracy? Please write in the comment box.