admin管理员组文章数量:1399754
Code :
var newurl = window.location.protocol + "//" + window.location.host + window.location.pathname +"?"+ queryStr;
window.history.pushState({path:newurl},'',newurl)
Current scenario :
Every time when window.history.pushState()
is invoked favicon requests occur rapidly.It makes network request for favicon on every call of this function.
Expected scenario :
The favicon should be loaded only once on page load, I would not expect the favicon load on every request of window.history.pushState()
.
Favicon paths are link like this in HTML page :
<!-- Favicon -->
<link rel="icon" type="image/png" href="../img/icon/favicon-16x16.png" sizes="16x16">
<link rel="icon" type="image/png" href="../img/icon/favicon-32x32.png" sizes="32x32">
<link rel="icon" type="image/png" href="../img/icon/favicon-96x96.png" sizes="96x96">
Code :
var newurl = window.location.protocol + "//" + window.location.host + window.location.pathname +"?"+ queryStr;
window.history.pushState({path:newurl},'',newurl)
Current scenario :
Every time when window.history.pushState()
is invoked favicon requests occur rapidly.It makes network request for favicon on every call of this function.
Expected scenario :
The favicon should be loaded only once on page load, I would not expect the favicon load on every request of window.history.pushState()
.
Favicon paths are link like this in HTML page :
<!-- Favicon -->
<link rel="icon" type="image/png" href="../img/icon/favicon-16x16.png" sizes="16x16">
<link rel="icon" type="image/png" href="../img/icon/favicon-32x32.png" sizes="32x32">
<link rel="icon" type="image/png" href="../img/icon/favicon-96x96.png" sizes="96x96">
Share
Improve this question
edited Aug 29, 2022 at 21:39
halfer
20.4k19 gold badges109 silver badges202 bronze badges
asked Mar 19, 2016 at 16:03
Rohìt JíndalRohìt Jíndal
27.2k15 gold badges77 silver badges132 bronze badges
1 Answer
Reset to default 9It looks like a bug in Chromium
browsers. See this open issue.
But there seems to be a workaround if you use base64
image as href
the request won't occur.
<link rel="icon" type="image/png" href="data:image/png;base64,iVBORw0KGgo=">
See this question.
本文标签: javascripthistorypushState in Chrome make favicon requestStack Overflow
版权声明:本文标题:javascript - history.pushState in Chrome make favicon request - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744141141a2592627.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论