detecting htaccess security

J

joe

Hello I am writing a script that uses xmlhttp.open, when i attempt to
open a protected page I get the login prompt for my htpasswd. Is it
possible to detect if there is a login requirement before the login
prompt and if there is a login just do something else? I can use
xmlhttp.status and check for 200 but if I do this then it would happen
after the login prompt. thanks.
 
T

Thomas 'PointedEars' Lahn

joe said:
Hello I am writing a script that uses xmlhttp.open, when i attempt to
open a protected page I get the login prompt for my htpasswd. Is it
possible to detect if there is a login requirement before the login
prompt and if there is a login just do something else?

No, XHR handles HTTP Authentication transparently. Meaning that you can
detect whether or not HTTP Authentication is used if the login fails (status
code and WWW-authenticate response header), but you can not prevent the
authentication dialog from being displayed before that.
I can use xmlhttp.status and check for 200

Or 401 if the login fails.
but if I do this then it would happen after the login prompt.

Exactly.


PointedEars
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top