By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,605 Members | 2,128 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,605 IT Pros & Developers. It's quick & easy.

how to make javascript not show up in client

P: 77
hello..

i have a question...
the script in javascript must be show up in client / html when we command "view source" in browser...

but i want to hide that script so it won't show up in client/html when command "view source" in browser

can i do that??how ?any idea?

thanks all,,

best regards,
mamin
Jul 23 '08 #1
Share this Question
Share on Google+
6 Replies


P: 57
Generally, you can't. You can write the code in a seperate file (using .js extension), but a determined surfer will be able to find it.
You could unescape small portions (see http://scriptasylum.com/tutorials/en...de-decode.html)

There are programs around that obfuscate your code, and you should be able to obfuscate your code (at least to an extent) manually as well. The simplest trick is to do the opposite of Good coding practice (ie use meaningless and indecipherable variable names, don't comment your code etc)...

Try searching for "Obfuscate Javascript"
Jul 23 '08 #2

rnd me
Expert 100+
P: 427
javascript can run, but it can't hide.
Jul 23 '08 #3

P: 77
javascript can run, but it can't hide.

nice..thanks

kind regards,

maminx
Jul 23 '08 #4

P: 77
nice..thanks

kind regards,

maminx

hey question again....

to not show up the javascript in client side /html is impossible, the other way is to encrypt the script, ok i agree...

but as i follow the tutorial in this URL Obfuscate Javascript

i must to trigger for encoding and the script must be in object so it has an id.
I can't do that because my script is located in the bottom of body, and it doesn't have any id or attribute

any idea??how to encrypt the script right from the page is opened, not triggered by event or attribute

thanks


kind regard,

mamin
Jul 24 '08 #5

rnd me
Expert 100+
P: 427
i really wouldn't bother. it wont stop me from viewing the output in the dom in firebug, and only makes tiny revisions a major PITA.

even without firebug, i would immediately recognize the decoder as a function, and unescape the source to get the decoder. wouldn't take more than a few seconds to crack. i use 'crack' lightly, because the system doesn't even need a password.


it also increase the size of your script files considerably.
Jul 24 '08 #6

acoder
Expert Mod 15k+
P: 16,027
Why is it so important to 'hide' this code?

See Hide JavaScript code from the client for a nice discussion on the subject.
Jul 29 '08 #7

Post your reply

Sign in to post your reply or Sign up for a free account.