开发者

Retrieve username/password from browser using javascript

My web server has authentication enabled. When I access my web server i get a pop-up from browser for username and pass开发者_运维问答word. After logged in, I want to retrieve the username from the browser using javascript. I am not using any kind of form to get the username/password. So, I am not setting any cookies also. Can we use DOM method to access the username? or any other way?

Regards, Anandan


As far as I know , you can't do that with javascript.

Check this link from php.net :

HTTP authentication with PHP : http://php.net/manual/en/features.http-auth.php


I guess you're talking about a apache directory authentication (basic/digest) ? If so you can't do that directly using javascript. You need to provide session information (username) retrived at the server side and passed to your browser. i.e (php script passing a Json object)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜