Javascript login via native popup

In the past, I saw javascript alert() popups, but they had input fields.

These forms are very similar to the primitive username and password input fields that you see when using the .htpasswd file.

Can someone tell me how to implement this using plain javascript? (No libraries please)

+7
javascript
source share
1 answer

Yes, you are thinking about prompt . It's simple:

 var userInput = prompt("text to display", "default input text"); 

Please note that this is just a general input mechanism. It is separate from the authentication dialog, although the same GUI controls can be used in the browser’s base code.

+9
source share

All Articles