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

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

问题描述

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

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"));
  }

我该如何解决?

推荐答案

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)

这是文档规范.

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

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