如何替换子资源请求中的嵌入式凭据 [英] how to replace embedded credentials in subresource requests

查看:712
本文介绍了如何替换子资源请求中的嵌入式凭据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I get this error in the console in my ionic app:

[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:

The line of code is a URL for an ajax request:

  function dbUrl() {
        return unescape(encodeURIComponent("http://idname:idnamepasswd@mysite.com/pDB.json"));
  }

你能帮我找一个简单的修补程序吗?

Can you help me find a simple fix ?

谢谢

推荐答案

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

The five-parameter version of the XMLHttpRequest.open method allows you to specify the username and password.

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

这是 documentation spec

这篇关于如何替换子资源请求中的嵌入式凭据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆