Hi Dilari
There is a fundamental problem in that, in the end, the browser has to send the password, which means that the browser has to know the password at that point. And if the browser knows it then it's possible for a person with access to that specific browser session to be able to get access to it.
Having said that, it's certainly possible to make it very hard to get access to it.
I suggest the following scheme:
When the user signs into your web-app, encrypt the password using the session ID and put it in a cookie.
When the browser needs to access the FTP server, grab the encrypted password from the cookie, decrypt it and use it to log into the server. This means that the password is not in the source, but only in an encrypted form in a short-lived cookie.
Obviously this requires that the client-side Javascript has the session ID for decrypting the password. Since this is on the client-side, it is possible for a hacker to get access to the password but they would need to know the session ID, so as long as that is kept secret it would be impossible for them to do that. Obviously the session ID is safer if this is happening over HTTPS.
Incidentally, you wouldn't have to use the session ID; you could use some other value that's known temporarily by the browser.
Does that make sense or have I misunderstood your question?
- Hans (EnterpriseDT)