javascript - 使用 JS 删除弹出警告框 "Authorization required"

标签 javascript api rest

我使用位于同一站点的 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

粗略翻译

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/

相关文章:

javascript - Pimcore:成功登录管理员后出现白屏死机

javascript - 谷歌地图 JavaScript API v3

python - 将 NumPy 数组导出到 Tableau 提取 (.tde)

javascript - Jquery仅隐藏最后通知

javascript - 将参数传递给主干中的事件

javascript - 根据状态 react 重置选择选项

iphone - iPhone 的反向查找 API?

java - 如何避免if-else树代码?

java - 野蝇 8/JAX-RS : UriInfo is null when injected into RequestScoped bean

python - 使用 API 在 Redash 上创建新查询