I\'m curious if there exists a method to intentionally slow the page load?
I\'m testing my HTML & PHP pages on my local host right now, and I want to see how my
This is what I would try: Use a php resource as source of the image:
<img src="images/gifLoager.php" />
in gifLoader.php, read your image file, output it byte by byte with a delay in the loop.
$fp = fopen( $path, 'rb');
while(!feof($fp)) {
print(fread($fp, 1024));
flush();
Sleep(1);
}
fclose($fp);
Don't forget to appropriately set the headers before outputting the binary data.
Referrences:
http://stackoverflow.com/questions/1563069/stream-binary-file-from-mysql-to-download-with-php
http://php.net/manual/en/function.sleep.php
http://www.gamedev.net/topic/427622-php-and-file-streaming-script-with-resume-capability/
UPDATE 2015-04-09 Use Chrome 'Device Mode': This tool has a network throttling feature that allows you to see how your page may render on a device with a slow network bandwidth. It has many other features that allow you to emulate features on various devices such as screen size and touch.
https://developer.chrome.com/devtools/docs/device-mode
A little bit of JS setTimeout can do the trick
setTimeout(function()
{
// Delayed code in here
alert('You waited 5 seconds to see me'); // Waits 5 seconds, then alerts this
}, 5000); // 5000 = 5 seconds
You can use sleep():
<?php
// Delays for 10 seconds.
sleep(10);
?>
...
html here
...
Moussa has the right idea. The best way to test a slow page load is to use Chrome's developer tools. Select the network tab, and then click the dropdown that says "No throttling". Then change the page to your desired speed.
This way is superior to using the sleep function because you don't have to mess with any code and then remember to take it out. If you want to change the speed, just change the throttling level and you're set.
For more information on throttling check out the docs.
In Chrome, you can simulate a slow Internet connection with the developer tools. under the "Network" Tab on the far right. You can use a preset like "Fast G3" or can create your own with exact numbers for upload, download and ping.
Reference: https://helpdeskgeek.com/networking/simulate-slow-internet-connection-testing/
you can use sloppy local web proxy to slow down your connection (it's in JAVA, so it'll probably run on your devel machine. You might also want to turn off mod_deflate for testing purposes, if you want so how your browser responds to slow HTML load (for example, dynamicly sized HTML tables, etc)
Also, see this question on webmasters.stackexchange.com