Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Intentionally Slow Down HTML/PHP Page Load to Test

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 loading gif etc will perform when the page load is slower.

I realize this is a rare request as most developers are only concerned with speeding up page loads, but I thought there might be a method, using either javascript/jQuery or PHP, to do something like this for testing purposes.

Thanks for any help!

Note: I'm testing on MAMP, so that's Apache server running on Mac OS 10.7

like image 825
stefmikhail Avatar asked Sep 13 '11 17:09

stefmikhail


People also ask

Does php include slow down?

Yes it will slowdown if you are including the script from other servers.

Is PHP slower than HTML?

You likely will not notice any performance decrease, as most web sites are written in a server-side scripting language such as PHP, ASP, CGI, Python, etc; and even some off the largest/most complicated sites in the world still load quite quickly.

How do I slow down Google Chrome?

You can use php's sleep($seconds) function to slow down a page load. However, you would need to turn implicit output buffer flushing to "on" with ob_implicit_flush(true); if you want anything to be sent to the user's browser before the page is done being processed.


1 Answers

You can use php's sleep($seconds) function to slow down a page load. However, you would need to turn implicit output buffer flushing to "on" with ob_implicit_flush(true); if you want anything to be sent to the user's browser before the page is done being processed. Otherwise your page won't have ANY contents until it's done loading. Calling sleep alone won't do the trick.

like image 57
Cyclone Avatar answered Oct 01 '22 08:10

Cyclone