0
How can I hide the content of the software on my site so that no one sees it when he presses F12
5 Answers
+ 3
Or
Donât put the good stuff in the front-end. If the logic/code is that important, make good architectural decisions where important code isnât left exposed.
Put âCopyright. All Rights Reservedâ on every web page, and if you catch someone stealing your stuff, lawyer up.
Accept that this is how the web operates and set expectations accordingly.
+ 2
you canât
HTML, CSS, and JavaScript are open text and viewable by the public. Thatâs just how web browsers work.
But if you canât get comfortable with how the web browsers lets browsers browse the webâŠ
Some techniques for protecting your source code:
1. Disable right click / context menu. I have done this for photographers who didnât want their photos stolen. Itâs not much, but it makes it nominally more difficult for someone to see whatâs going on. Itâs the equivalent of putting a safety on a gun; âoh, I have to push a button to shoot someone?â Thereâs still app menus where the user can inspect element, and thereâs still view-source, which is basically accessible via a URL. Good luck trying to debug any CSS issues you have.
2. Obfuscate JavaScript. Because JavaScript allows type coercion of all its types, that makes it oddly friendly for obfuscation. Obfuscated JavaScript could look like utter nonsense, making it hard for someone to peek in your JavaScript and reuse or abuse it. But, even obfuscated JS still runs! And, just about any browser debugging tool will allow someone to step into, out of, and modify functions. So itâs not any harder to modify and abuse in the browser. Just harder to read. If itâll help you sleep at night, you can use a Javascript Obfuscator . Just remember that obfuscated code is harder for YOU to read, too. Good luck debugging production issues.
3. Punish the thief: Put some code in your JavaScript that will check and see if itâs on the right domain. If the code is on the wrong domain, put up an ass-load of unicorns and a nice message. Of course, your JavaScript is still readable, so once the thief sees the message, he or she will look through your code and yank it out. So you might as well obfuscate all of your JavaScript. Good luck migrating between environments.
4. Mess with the console. One of the chief ways people will mess with your open and visible JavaScript is using the browserâs console. Thatâs where they go to execute and test variables and code.
+ 2
(function () {
const rgx = new RegExp(/(domainName)|(:portNumUsedInLocalDev)|/g);
const host = window.location.host;
const isMatch = !host.match(rgx);
function showWarning() {
let warning = document.createElement('h1');
warning.innerText = 'DON\'T STEAL';
warning.style.fontSize = '5em';
warning.style.fontWeight = 700;
warning.style.position = 'fixed';
warning.style.left = `${(window.innerWidth/2)}px`;
warning.style.top =`${ window.innerHeight /2}px`;
warning.style.zIndex = 9999;
document.body.appendChild(warning);
}
function exactRvg () {
cornify_add();
window.setTimeout(()=> {
exactRvg();
}, 500);
}
if (isMatch ) {
showWarning();
$.getScript('https://www.cornify.com/js/cornify.js',function(){
exactRvg();
});
}
})();
+ 2
console._log = console.log
console.log = function (log) {
return console._log(`%c ${log}`, 'color:rgba(255,255,255,0)');
}
0
shoriful islam 44@email.com