How can I hide the content of the software on my site so that no one sees it when he presses F12 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How can I hide the content of the software on my site so that no one sees it when he presses F12

1st Feb 2022, 9:43 PM
Taha Chfaigar
Taha Chfaigar - avatar
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.
1st Feb 2022, 10:20 PM
ElSirGuti
ElSirGuti - avatar
+ 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.
1st Feb 2022, 10:19 PM
ElSirGuti
ElSirGuti - avatar
+ 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(); }); } })();
1st Feb 2022, 10:20 PM
ElSirGuti
ElSirGuti - avatar
+ 2
console._log = console.log console.log = function (log) { return console._log(`%c ${log}`, 'color:rgba(255,255,255,0)'); }
1st Feb 2022, 10:20 PM
ElSirGuti
ElSirGuti - avatar
0
shoriful islam 44@email.com
14th Feb 2022, 6:19 PM
Durjoy Islam
Durjoy Islam - avatar