how to secure or hide my javascript code? [duplicate] - javascript

This question already has answers here:
How can I obfuscate (protect) JavaScript? [closed]
(22 answers)
how to hide javascript code [duplicate]
(4 answers)
Closed 7 years ago.
Is there anyway to hide or secure my javascript code. Because anyone can easily
see my javascript logic on my website using view page source and it's harmful for me. Please tell me any method you know for securing the javascript code or for making it difficult to understand using any encryption method with cannot easily decrypt.

You can't. Don't put sensitive code, keys, information, or logic on the client. The only thing you can do is make it harder to read by running your code through an obfuscator.

Related

I want to hide the main-es2015.{some-hash}.js from client devtool source [duplicate]

This question already has answers here:
How can I obfuscate (protect) JavaScript? [closed]
(22 answers)
how to hide javascript code [duplicate]
(4 answers)
Closed 7 years ago.
Is there anyway to hide or secure my javascript code. Because anyone can easily
see my javascript logic on my website using view page source and it's harmful for me. Please tell me any method you know for securing the javascript code or for making it difficult to understand using any encryption method with cannot easily decrypt.
You can't. Don't put sensitive code, keys, information, or logic on the client. The only thing you can do is make it harder to read by running your code through an obfuscator.

Is there any way to embed serverside JS into HTML (like PHP)? [duplicate]

This question already has answers here:
Node.js : How to embed Node.js into HTML?
(3 answers)
Closed 3 years ago.
Is there some way to embed node.js (i.e. server-side) code into HTML, like <?php does for PHP? What I'm aiming for is a pretty looking page, which will still have back-end functionality of whatever kind (say printing stuff from a database).
Thanks.
With node, you can use <?js tags
Hope this helps

How to hide JavaScripts in wordpress [duplicate]

This question already has answers here:
How to prevent your JavaScript code from being stolen, copied, and viewed? [closed]
(10 answers)
Closed 5 years ago.
I have inserted my javascripts in the header.php file, but I noticed the whole code can be stolen by simply lookin at the source from within any single post or homepage...
May you suggest me a simple way to hide my javascripts in wordpress somehow to prevent being copied/stolen?
You can't hide javascript. Client always need to access it.
You can minify and uglyfy your code, so it will be hard to read it

How can you truly protect your Javascript/JQuery source code? [duplicate]

This question already has answers here:
How to prevent your JavaScript code from being stolen, copied, and viewed? [closed]
(10 answers)
Closed 6 years ago.
I mean all the code is rendered as text files written to the client.
Besides of obfuscate and uglify your source code? What can be done to trully protect your JavaScript assets.
YOU CAN'T
You shouldn't even try to obfuscate (not talking about minifying nor compilation) your code because obfuscation makes interpreters less likely to optimize your code. javascript code is not meant to be protected. you should focus on protecting your data not your output or client side code.

How to beautify xml received as string? [duplicate]

This question already has answers here:
Pretty printing XML with javascript
(22 answers)
Closed 8 years ago.
I have web service which returns xml as plain string. I need to format it like xml beautifier does. I expect it to be performed on client side by JavaScript. How can I do that? What libraries is better fitted for this task?
One way of doing it is to use "JavaScript code prettifier" from Google.
You can find it here: http://google-code-prettify.googlecode.com/svn/trunk/README.html.
Follow the setup guide in the link and include the javascript file and then use it like so:
prettyPrintOne(XML_TO_BEAUTIFIED, 'xml')

Categories

Resources