When I use tools.pingdom.com, I can see that my website is loading twice unnecessarily. The first time www.junkluggers.com is loaded, a cookie is set. Then part way through the loading process, www.junkluggers.com is loaded again, this time containing the cookie that was previously set and cached. I’m assuming this double loading is unnecessary. How can I prevent it?

The test: http://tools.pingdom.com/fpt/#!/dQNuas/http://junkluggers.com

The first loading:
enter image description here

The second loading, now with the cookie:
enter image description here

1 Answer
1

As I’ve found, this happens when your html, css or javascript tries to load a resource and you haven’t specified a path or wrongly specified root.

For instance, I’ve seen examples on people having this problem while doing

<img src="https://example.com" />

background:url();

In my case specifically, was assigning $.ajax() to a global variable so I could work with it later, like this

var map_markers = $.ajax();

clearly I don’t know enough javascript, regardless, this $.ajax() was causing the site to load twice.

Hope this helps someone googling. If you suspect this is happening, http://tools.pingdom.com/ will show you what loads in your site.

Leave a Reply

Your email address will not be published. Required fields are marked *