Search code examples
javascriptclient-sidecopy-protectiondata-protection

hide source code after script finishes loading


This question is different because I don't want to prevent the user from viewing source. I want to hide a portion of the source code programmatically. "Duplicate" questions do not address this and some of the answers on this question begin to address it.

is it possible in javascript to hide the code after a script finishes loading? I would like to protect my script from peering eyes, outside of a restrictive licensing regime.

I think that removing the code would disable any interactive portions of a page leaving a static shell, depending on the library. But how do people / the industry approach this problem?

is it just court enforced licensing regimes and copyright registration? or is there something more clever that can be done in software regarding client side javascript


Solution

  • is it possible in javascript to hide the code after a script finishes loading

    => No

    I think that removing the code would disable any interactive portions of a page leaving a static shell

    => You could remove the script tags from the html structure, but as the code has already been parsed your interactive portions would still work

    is there something more clever that can be done in software regarding client side javascript

    => Accept that people can read your minified code and won't spend much time trying to decipher it, because they already have jQuery, backbone and other libraries anyway. Invest your precious time on a better vnext rather than trying to hide the current version.