How to make the browser pop up a login box, like Tomcat login mode

problem description

how to make the browser pop up a login box, like Tomcat login

the environmental background of the problems and what methods you have tried

this is the only input mode in the pop-up dialog
var user = window.prompt ("Please enter your name", ");

related codes

/ / Please paste the code text below (do not replace the code with pictures)

what result do you expect? What is the error message actually seen?

Mar.05,2022

this is called Basic authentication . When you visit a protected resource, the server responds to 401 status code, and the browser will pop up an input box asking the user to enter credentials . pac4j provides a series of authentication methods, including Basic authentication . Download pac4j official demo at a glance.


js cannot be implemented, and you need to use a backend configuration, such as nginx

.

reference


I don't quite understand what you're talking about. Can you be specific? If it is a simple login interface operation, it is very simple, front-end processing is fine.

Menu