Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Prefetching

Featured Replies

I recently came across the perfecting feature:

<link rel="dns-prefetch" href="//google-analytics.com">
<link rel="dns-prefetch" href="//www.google-analytics.com">

My take on this is that the above example would force Google Analytics to load up last, but does this really help?

Where in the headers would the Prefetching need to go to be of some use?

They need to go inside your <head> before any of the third-parties are called. They basically resolve the DNS ahead of time, so that you don't have to wait for the DNS to resolve when you get to the external resource. This generally means the script is ready to be fetched once the browser gets to it, rather than having to sit there waiting. It still has to fetch the data, but it has already verified the DNS at this point and can get straight to doing that. 

If you have 5 third-party scripts, 5 DNS lookups have to occur, and rendering will be blocked in the meantime. You can't be certain of how long this process will take either. This tag won't control the loading of assets in the case you've mentioning above, it's not a queueing system, it's just a way to tell the browser what to expect before it gets to it.

  • Author
1 hour ago, Jack said:

This tag won't control the loading of assets in the case you've mentioning above, it's not a queueing system, it's just a way to tell the browser what to expect before it gets to it.

Is it worth having for something like Google Analytics, or is it not going to make any real difference?

It's not going to make any real difference.

Or you could use an altrernate analytics pacakage - one that load's in the footer not the header. My vote goes for http://clicky.com/ It's a much better package than GA.

13 hours ago, fisicx said:

It's not going to make any real difference.

Or you could use an altrernate analytics pacakage - one that load's in the footer not the header. My vote goes for http://clicky.com/ It's a much better package than GA.

I could be mistaken as I've not used GA in ages but I'd be pretty sure that it will load async so it doesn't really matter if it goes in the header or the footer in this case.

You can put GA in the footer but you may not track all visitors correctly if you do. Google explicitly says to add it to just before the closing </head>

On 10/02/2018 at 10:44 AM, fisicx said:

You can put GA in the footer but you may not track all visitors correctly if you do. Google explicitly says to add it to just before the closing </head>

What I am saying is that the vast bulk of it's assets will be fetched asynchronously so it's not like you are blocking the browser by putting a large script in the head.

If anybody has performance reservations they should be tested.  Putting scripts in the head does not always cause browser rendering to be blocked like the old days.

Edited by rbrtsmith

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.