文件说明.基本 URI 行为

Explanation of document.BaseURI behaviour

本文关键字:行为 URI 基本 说明 文件      更新时间:2023-09-26

在Chrome中调试一些javascript代码时,我遇到了下一件事:

如果像这样传递给 xhr.open 相对 URL(比如"mail.fpp?a=123sd"(。

xhr.open("post", "mail.fpp?a=123sd", true)

请求将在

https://www.somedomain.com/mail/mail.fpp?a=123sd

一切都很好,但有记录。URI(和 document.location.toString((( 具有值

https://www.somedomain.com/default.aspx?id=12345

我注意到 baseURI 有价值

https://www.somedomain.com/mail/

但根据文档文档。基本 URI 只读。

为什么记录。URI(或 document.location.toString((( 不等的文档。基数?是什么导致了这种不平等?

解决方案很简单,有基本标签。你啦啦啦啦