Mehdiway Mehdiway - 1 year ago 122
HTML Question

Javascript - Using with Basic Authentication

When the user logs into my app, he can click on a button to download a CSV file from the server. This URL for the download is protected using basic authentication. When I do this :'http://url-of-the-csv-file');

The browser shows a username/password popup (Basic Authentication)

I want to be able to open the URL without asking the user to enter his password a second time. How do I do that ?

myf myf
Answer Source

If you know basicAuth credentials of your looged-in user, you could fill in them in the URL:


If your app is in open web, do it ONLY if the target is on HTTPS, because such request including credentials will be readable for anyone eavesdropping your wires. This also applies to the other (javascript) answer.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download