JS

HOW TO HIDE JAVASCRIPT CODE FROM CLIENT

Scramble Javascript code, make it impossible for humans to read. Just use an online tool to obfuscate.

OBFUSCATE SCRIPT

01

NO RIGHT-CLICK > VIEW SOURCE CODE document.addEventListener(   "contextmenu", (e) =>   { e.preventDefault(); }, false );

DISABLE RIGHT CLICK

02

NO CTRL-U TO SHOW SOURCE CODE NO F12 TO BRING UP CONSOLE document.addEventListener(   "keydown", (e) => {     if (e.ctrlKey || e.keyCode==123) {       e.stopPropagation();       e.preventDefault();     } });

DISABLE SHORTCUT KEYS

03

IMPOSSIBLE TO FULLY HIDE JS Client-side Javascript is downloaded into the user's device in clear-text.

"PROTECTION GIMMICKS" Obfuscation can be reverse-engineered. Disabled keys can be bypassed in many ways.

BEST TO SEEK ALTERNATIVES Beef up security checks on the server-side.

ANNOYING & NOT FOOLPROOF!

04