D
D
darknez2015-10-26 08:30:10
HTML
darknez, 2015-10-26 08:30:10

How to protect site code when viewed in a browser editor?

Hello, please tell me how to be. There is a site where I provide demo templates and the question is to hide the code there from draining the template (displaying in a frame or something else), for example, you press the button to view the template demo, and it redirects to a page with an encrypted code inside, but the template itself shows fine. If anyone has experienced this, can you please let me know if this is possible? (I hope I explained well)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Mark Doe, 2015-10-26
@darknez

There is no universal protection - the code is still executed on the client, and in any case it can be downloaded / copied.
However, as a protection against completely unprofessional ones - you can add such code to js scripts (including libraries like jQuery) (after obfuscating it)

if(document.domain!="yourdomain.com"){
   self.location.href = "http://yourdomain.com";
}

Thus, even the saved file will not work outside your domain. However, again, this is protection only from an inexperienced user, any more or less knowledgeable person will still be able to save your template

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question