Chrome plugin development: user:pass@url not supported by Google Chrome anymore?

I develop a Chrome plugin that uses XMLHttpRequest to send a GET HTTP request with an username/password to a basic-auth-protected URL, so that it can then "auto-login" to it afterwards (since Chrome caches credentials for HTTP basic-auth).

Here's the code I use:

  var xml = new XMLHttpRequest();
  xml.open('GET',<url>,false,<username>,<password>)
  xml.send('');

It used to work fine for quite a while, but started failing some time ago. The plugin code hasn't changed, so I thought it could have to do with Chrome itself. I downloaded a previous version for OSX (17) and BAM, it worked again.

After some additional research, I found out that it might have to do with Chrome 19 not supporting the username:pwd@url syntax for authenticating to basic-auth protected URLs, because when I send the XMLHttpRequest, I see this in Google Chrome's js console:

GET http://user:pass@domain.com 401 (Unauthorized)

Does anyone know whether it's a bug or if Chrome stopped supporting this feature?

Thanks,

Marcelo.


You are not the only person having this issue. It's ruffled several other people's feathers.

However, given the comments from the Chromium Developers:

The support for embedded auth in URLs was intentionally deprecated.

It looks like it was removed intentionally.

链接地址: http://www.djcxy.com/p/22306.html

上一篇: 第一个XMLHttpRequest失败,但只在IE9上

下一篇: Chrome插件开发:用户:Google Chrome不再支持pass @ url?