I've been thinking about your question. What you also can do is trigger the HTTP authentication pop-up from within your website. A browser will show a login popup when a webserver sends a 401. You have to handle the login information in the following request yourself. How this is done can be found in
this RFC [www.faqs.org].