我使用位于同一站点的 API。后端要求每个请求 header 加密登录/密码系统基本 HTTP 身份验证 - Basic access authentication
粗略翻译
Authentication required, to access the server http://gkeep.ua:80 you've to provide your credentials. Server message: Secured Area
它与普通的alert()
、prompt()
和confirm()
是同一类型
我想通过重写函数来禁用此窗口
window.alert = function () {}; alert (12345); // does not work
但好像不是alert()
, audio prompt()
or confirm()
一般不一样,怎么关掉,不懂
谁能面对这样的任务,如果你能告诉我如何解决,我将不胜感激
最佳答案
it is the same type as a normal alert (), prompt () and confirm ()
不,不是。这是浏览器在收到 HTTP 状态代码 401 Unauthorized
时弹出的身份验证对话框,与 JavaScript 无关——这就是为什么您也不能通过 JavaScript“禁用”它。
关于javascript - 使用 JS 删除弹出警告框 "Authorization required",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32440025/