最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Why is Google Chrome loading page andor resources multiple times? - Stack Overflow

programmeradmin2浏览0评论

We have had this problem with one of our web applications for a long time now. Google Chrome loaded all resources twice and ran all scripts and everything on the page twice for some reason.

It could not be because of some refresh or redirect because the developer console did not clear / reset halfway and if there was something refreshing or reloading the page, then that would be happening infinite times.

This only happened on Google Chrome, too. It was making our web application really really slow to load and use.

I am sharing an answer (below?) to this issue at it was surprisingly tough to find cause for and the bug itself lowers performance possibly hundreds of percents.

We have had this problem with one of our web applications for a long time now. Google Chrome loaded all resources twice and ran all scripts and everything on the page twice for some reason.

It could not be because of some refresh or redirect because the developer console did not clear / reset halfway and if there was something refreshing or reloading the page, then that would be happening infinite times.

This only happened on Google Chrome, too. It was making our web application really really slow to load and use.

I am sharing an answer (below?) to this issue at it was surprisingly tough to find cause for and the bug itself lowers performance possibly hundreds of percents.

Share Improve this question asked Oct 19, 2015 at 13:09 SwiffySwiffy 4,7253 gold badges27 silver badges56 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 4

First we thought it was some wacky cache bug, in where the resources somehow got expired during page load, but we could not find anything to support that theory.

Then after some googling I found this: https://codebuildplay.wordpress./2014/03/06/chrome-loads-page-twice-sitecore-dms-gets-faulty-usage-data/

They found out that if there are elements with src = "" or css-rules like url(''), it would cause Google Chrome to think that the src or url refers to the website root path and therefore causes the page with all its resources to be loaded there.

For us this was and was not the case. We had an "extended version" of this same problem by having an url = "#", which seems to be the same as url = "". So having a # in the url or src also produces this bug.

The source of this problem can be potentially found by watching the developer console's network view and looking for a cancelled index.php / index.html / similar resource. The line number where this resource was requested should tell where do you have a faulty src attribute. I do not think this works if the problem exists in a css url rule.

I also wrote a small script that might help pinpoint elements that have faulty urls or srcs: https://gist.github./ahvonenj/8e2eef80590e200dd297

I hope this helps whoever encounters this really annoying, performance wrecking problem.

In my case problem solved by linking a valid icon to href below although i have some other empty href / src in my html (its under development yet).
tested on Chrome Android And Desktop Version 56.0

<link rel="icon" href="">
发布评论

评论列表(0)

  1. 暂无评论