Skip to main content
added 392 characters in body
Source Link
Attie
  • 121
  • 4

I don't think this happens like you think it does...

From your description, it sounds like you're expecting browsers to just follow URLs to preload whole pages - but from what I know it's a lot more explicit than that...

The "Prefetching, preloading, prebrowsing" article on CSS-Tricks goes some way to dispel your presumptions.

The wiki page on "Link Prefetching" backs this up:

Prefetching is accomplished through hints in web pages

If we had browsers randomly following URLs, then all sorts of things would start to break down - up/down vote buttons would be "clicked", views on other pages would rack up just by a user viewing one other page, etc...

Also, remember that most of these are "hints" anyway, and browsers don't have to follow them.


If you are concerned about using resources from another server, then the simple answer is "don't".

Facebook / Twitter / Youtube / etc... will provide a snippet that you can drop into your pages to "magically" get the functionality... You'll want to avoid this, where possible. Instead, interface with their public APIs upon explicit user interaction (see @grawity's answer).


DNS prefetching

This requests that the browser query a DNS record now in order to reduce load times later.

It requires HTML in the <head> section:

<link rel="dns-prefetch" href="//example.com">

Preconnect

Allows the browser to make a TCP connection and complete the TLS negotiation ready for use (think HTTP/2 and multi-use connections / pipelining):

It requires HTML in the <head> section:

<link rel="preconnect" href="http://css-tricks.com">

Prefetching and Preloading

Retrieves a specific resource, ready for use - probably holding it in the browser's cache - think images for a slideshow, etc... Preloading is a must, while Prefetching is a hint.

They require HTML in the <head> section:

<link rel="prefetch" href="image.png">
<link rel="preload" href="image.png">

Prerendering pages

Loads an entire page - along with all assets and dependancies. Think those "20 things you'd never expect from X" sequence of pages...

It requires HTML in the <head> section:

<link rel="prerender" href="http://css-tricks.com">

All browsers are different, and they are constantly evolving...

DNS prefetch is a simple thing to do, which doesn't leak your intent to the web server, but it does query the user's DNS server... so if that's of concern to you, then the X-DNS-Prefetch-Control header you've identified may be useful... but don't forget to look at the browser compatibility - IE, Edge and Safari might not play nice.

Chrome does quite a bit to anticipate the user's intentions, as outlined in this great slide deck.


Ultimately, the best option for privacy is a browser extension (which the user would have to install) - there isn't a huge amount you can do to restrict the browser's actions as a website.

I don't think this happens like you think it does...

From your description, it sounds like you're expecting browsers to just follow URLs to preload whole pages - but from what I know it's a lot more explicit than that...

The "Prefetching, preloading, prebrowsing" article on CSS-Tricks goes some way to dispel your presumptions.

The wiki page on "Link Prefetching" backs this up:

Prefetching is accomplished through hints in web pages

If we had browsers randomly following URLs, then all sorts of things would start to break down - up/down vote buttons would be "clicked", views on other pages would rack up just by a user viewing one other page, etc...

Also, remember that most of these are "hints" anyway, and browsers don't have to follow them.


DNS prefetching

This requests that the browser query a DNS record now in order to reduce load times later.

It requires HTML in the <head> section:

<link rel="dns-prefetch" href="//example.com">

Preconnect

Allows the browser to make a TCP connection and complete the TLS negotiation ready for use (think HTTP/2 and multi-use connections / pipelining):

It requires HTML in the <head> section:

<link rel="preconnect" href="http://css-tricks.com">

Prefetching and Preloading

Retrieves a specific resource, ready for use - probably holding it in the browser's cache - think images for a slideshow, etc... Preloading is a must, while Prefetching is a hint.

They require HTML in the <head> section:

<link rel="prefetch" href="image.png">
<link rel="preload" href="image.png">

Prerendering pages

Loads an entire page - along with all assets and dependancies. Think those "20 things you'd never expect from X" sequence of pages...

It requires HTML in the <head> section:

<link rel="prerender" href="http://css-tricks.com">

All browsers are different, and they are constantly evolving...

DNS prefetch is a simple thing to do, which doesn't leak your intent to the web server, but it does query the user's DNS server... so if that's of concern to you, then the X-DNS-Prefetch-Control header you've identified may be useful... but don't forget to look at the browser compatibility - IE, Edge and Safari might not play nice.

Chrome does quite a bit to anticipate the user's intentions, as outlined in this great slide deck.


Ultimately, the best option for privacy is a browser extension (which the user would have to install) - there isn't a huge amount you can do to restrict the browser's actions as a website.

I don't think this happens like you think it does...

From your description, it sounds like you're expecting browsers to just follow URLs to preload whole pages - but from what I know it's a lot more explicit than that...

The "Prefetching, preloading, prebrowsing" article on CSS-Tricks goes some way to dispel your presumptions.

The wiki page on "Link Prefetching" backs this up:

Prefetching is accomplished through hints in web pages

If we had browsers randomly following URLs, then all sorts of things would start to break down - up/down vote buttons would be "clicked", views on other pages would rack up just by a user viewing one other page, etc...

Also, remember that most of these are "hints" anyway, and browsers don't have to follow them.


If you are concerned about using resources from another server, then the simple answer is "don't".

Facebook / Twitter / Youtube / etc... will provide a snippet that you can drop into your pages to "magically" get the functionality... You'll want to avoid this, where possible. Instead, interface with their public APIs upon explicit user interaction (see @grawity's answer).


DNS prefetching

This requests that the browser query a DNS record now in order to reduce load times later.

It requires HTML in the <head> section:

<link rel="dns-prefetch" href="//example.com">

Preconnect

Allows the browser to make a TCP connection and complete the TLS negotiation ready for use (think HTTP/2 and multi-use connections / pipelining):

It requires HTML in the <head> section:

<link rel="preconnect" href="http://css-tricks.com">

Prefetching and Preloading

Retrieves a specific resource, ready for use - probably holding it in the browser's cache - think images for a slideshow, etc... Preloading is a must, while Prefetching is a hint.

They require HTML in the <head> section:

<link rel="prefetch" href="image.png">
<link rel="preload" href="image.png">

Prerendering pages

Loads an entire page - along with all assets and dependancies. Think those "20 things you'd never expect from X" sequence of pages...

It requires HTML in the <head> section:

<link rel="prerender" href="http://css-tricks.com">

All browsers are different, and they are constantly evolving...

DNS prefetch is a simple thing to do, which doesn't leak your intent to the web server, but it does query the user's DNS server... so if that's of concern to you, then the X-DNS-Prefetch-Control header you've identified may be useful... but don't forget to look at the browser compatibility - IE, Edge and Safari might not play nice.

Chrome does quite a bit to anticipate the user's intentions, as outlined in this great slide deck.


Ultimately, the best option for privacy is a browser extension (which the user would have to install) - there isn't a huge amount you can do to restrict the browser's actions as a website.

Post Migrated Here from superuser.com (revisions)
Source Link
Attie
  • 121
  • 4

I don't think this happens like you think it does...

From your description, it sounds like you're expecting browsers to just follow URLs to preload whole pages - but from what I know it's a lot more explicit than that...

The "Prefetching, preloading, prebrowsing" article on CSS-Tricks goes some way to dispel your presumptions.

The wiki page on "Link Prefetching" backs this up:

Prefetching is accomplished through hints in web pages

If we had browsers randomly following URLs, then all sorts of things would start to break down - up/down vote buttons would be "clicked", views on other pages would rack up just by a user viewing one other page, etc...

Also, remember that most of these are "hints" anyway, and browsers don't have to follow them.


DNS prefetching

This requests that the browser query a DNS record now in order to reduce load times later.

It requires HTML in the <head> section:

<link rel="dns-prefetch" href="//example.com">

Preconnect

Allows the browser to make a TCP connection and complete the TLS negotiation ready for use (think HTTP/2 and multi-use connections / pipelining):

It requires HTML in the <head> section:

<link rel="preconnect" href="http://css-tricks.com">

Prefetching and Preloading

Retrieves a specific resource, ready for use - probably holding it in the browser's cache - think images for a slideshow, etc... Preloading is a must, while Prefetching is a hint.

They require HTML in the <head> section:

<link rel="prefetch" href="image.png">
<link rel="preload" href="image.png">

Prerendering pages

Loads an entire page - along with all assets and dependancies. Think those "20 things you'd never expect from X" sequence of pages...

It requires HTML in the <head> section:

<link rel="prerender" href="http://css-tricks.com">

All browsers are different, and they are constantly evolving...

DNS prefetch is a simple thing to do, which doesn't leak your intent to the web server, but it does query the user's DNS server... so if that's of concern to you, then the X-DNS-Prefetch-Control header you've identified may be useful... but don't forget to look at the browser compatibility - IE, Edge and Safari might not play nice.

Chrome does quite a bit to anticipate the user's intentions, as outlined in this great slide deck.


Ultimately, the best option for privacy is a browser extension (which the user would have to install) - there isn't a huge amount you can do to restrict the browser's actions as a website.