Detecting connection speed

Is there a way of detecting the connection speed of the user´s computer and then redirect him to a URL?

Tx