-2

:)

I've a website with some fancy scripts and pictures. But some of them are not necessary to get the information, but just look cool.

If someone has a good internetconnection he does not care about some scripts to load. But if he has e.g. just gprs I want him just to load the Text and only important pictures.

Is there some way to get the connection speed?

Thank you very much!

Thamilhan
  • 13,040
  • 5
  • 37
  • 59

1 Answers1

0

Detecting Internet speed for every single page request might be slow and burdensome on the client and/or server, and some users may just prefer to not load the unnecessary content. I propose an alternative solution: add code in your PHP (I assume) script that does not echo/output the <script>s and <img>s (etc.) when a query string is received:

<?php
$addExtraContent = empty($_GET['fast']);
...
if ($addExtraContent):
?>
<script src="heavy_script.js"></script>
<?php
endif;
?>

This way, just tell your users to add ?fast to the end of the URL to load the page without unnecessary content. It's not that hard to remember or do, and doesn't require any tests or delays. It's not even that much more code (and zero client-sided code).

wilsonzlin
  • 2,154
  • 1
  • 12
  • 22
  • Thanks for that idea! - The detection of speed will be on the first page. Later it will be stored in PHP-Session to skip the test. – Reiner Zufall Apr 27 '16 at 08:54