htaccess Login | JavaScriptSource

htaccess Login

Gordon Hudson Jun 12, 2001
Allows you to have a login box embedded in your web page for pages that normally is only available through a pop up dialogue box. Cool!


The JavaScript Source: Navigation: htaccess Login

Simply click inside the window below, use your cursor to highlight the script, and copy (type Control-c or Apple-c) the script into a new file in your text editor (such as Note Pad or Simple Text) and save (Control-s or Command-s). The script is yours!!!


Did you use this script?  Do you like this site?  Please link to us!

Leave a Response


Worked great! Not sure what people above are complaining about. Would be nice to know if there is anyway to use javascript to handle incorrect logins instead of displaying the native htaccess login window if incorrect. Anywho.. Thanks again for the great example!

Dan Jun 27, 2013

Works great! Thanks! My only suggestion is to remove the pop up you are about to log in with username ___ because it is rather redundant as it goes without saying. Possible to remove that? Also in IE there's an error: Invalid argument and it won't log in. Lame IE! But still some are using it.

John Boyd May 25, 2013

Because you need to use an .htaccess login file, as the name of the script suggests.

Lee Jan 16, 2009

It should be as shown: "". You would also need to [a href=""]create the login info[/a] in an .htaccess file. For additional information, you will need to post your question on [a href=""]the JavaScript forum[/a]. Thanks!

Lee Jan 16, 2009

Could you please explain where I put the username and password that people could use to login to this page? And can this be used to when the visitor clicks login it takes you to a separate html file that is within a hidden or secure folder?[br /][br /]I love the script and format, just looking for a little more direction to make it work! Thanks!

Kiley Jan 14, 2009