怎样查看或修改html的绝对路径

查看用 Node.prototype.baseURI, 修改用 <base>;

document.baseURI; // https://www.cnblogs.com/aisowe
// <base href="https://www.google.com/" />
// <a href="/test.html"> test </a>

document.querySelector('a').baseURI; // https://www.google.com/

 

若无法获取, 则返回null.

 

posted on 2019-09-11 09:49  aisowe  阅读(866)  评论(0)    收藏  举报

导航