如何替换子资源请求中的嵌入式凭据?

路易

我在Ionic应用程序的控制台中收到此错误:

[Deprecation] Subresource requests whose URLs contain embedded credentials (e.g. `https://user:pass@host/`) are deprecated, and will be blocked in M59, around June 2017.

该行代码是ajax请求的URL:

  function dbUrl() {
        return unescape(encodeURIComponent("http://idname:[email protected]/pDB.json"));
  }

我怎样才能解决这个问题?

马尼纳克

该方法的五参数版本XMLHttpRequest.open允许您指定用户名和密码。

xhr.open(method, url, async, username, password)

这是文档规范

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章