Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 265
  • Last Modified:

how to hide code in java scripts

hi there
Well i have to hide the java script code on the server. that is the code written in .js file extention and called in asp page. but in this case one can edit the code on server side. So is there any code hidden / encryption techniques available?. So that no one can easily temper the code in js file.
regards
usman
0
usmanshahid
Asked:
usmanshahid
1 Solution
 
fargoCommented:
Hii,

Well what do u mean by someone can edit the code on the server side?? To hide the javascript code u can make use of external js files.

for ex:
<SCRIPT LANGUAGE="JavaScript" SRC="urfilepath.js"></SCRIPT>

revert back if u have any problems.

hope this helps.
thanks and regards
0
 
voskCommented:
I don't think that externals scripts can hide the javScript code because you can open the direction (url pagefolfolder + *.js filename) and download as all formats. Maybe the most secure way is using some security code, something like cgi to read from a server file, so you cannot have acces. But that is too many writing for something like that.
Surely that there's a lot of pages with encrypt techniques, but I only know www.astalavista.com
That page is updated every day (or every month), and sometimes I have seen some encryption articles. Maybe you can find something useful.
jbosch(vosk)
0
 
AntithesisCommented:
Maybe you could use a server side language to verify that the request is coming from one of the pages.  I've never really wanted to hide javascript this badly, so I've never looked into it.
0
 
usmanshahidAuthor Commented:
hi all
Well i was talking about that when a client requests for a page then the java scripts code also comes to him even u place java scripts code in seperate .js extention file. and also one who has access the webserver can also temper the java scripts.SO is there any method how u hide/ encrypted code from both..i.e client one and from server one.
regards
usman
0
 
voskCommented:
Take a look to the script that calls your *.js file:
<script src="file.js"></script>
Is necessary to carge both files (html + js) because the html needs the surce from where read the javascript codes and execute them as faster as the pc lets.
The other solution about read from the server with some security scripting will convert your page into a "please wait while first function is loading..." "please wait while second function is loading..." "please wait while third function is loading..." and I really wouldn't like to wait and wait in front of my pc while a simple javascript code is loading separately depending of what function is needed (and I'm not the only user that thinks that). Also I'm not sure that a simple interval can run dynamically with in this way.

Another thing is that you don't want to leave the used files on the user's temporary folder. Then is there a way to do that: a meta tag that tells to the browser that on exit from the page remove all the files that the page have had to charge on the temp folder. But I didn't used never and I don't know if that is the tag that I mean:
<META HTTP-EQUIV="Expires" CONTENT="0">
That tag prevents the page to being cached, but I don't know if that means that won't leave temp files or that always is readed from the server (even during the same session), or both things... But also you won't hide the js file, always will be accessible do download it.
If you are thinking about make a password with javascript an hide the code, the better way is to forget that idea and learn to use php, cgi, asp or other security code. Do not encrypt because then you'll need to decrypt all the code, and that means a lot of time and a lot of script (surely complicated script).
Hope that now you have a clearer idea about what do you want: speed or slowness with a lot of scripting.
Also hope that will help you.
jbosch(vosk)
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now