Sunday, May 19, 2024
 Popular · Latest · Hot · Upcoming
21
rated 0 times [  22] [ 1]  / answers: 1 / hits: 35060  / 13 Years ago, tue, september 13, 2011, 12:00:00

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


More From » php

 Answers
23

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.


[#90119] Monday, September 12, 2011, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
kearaw

Total Points: 713
Total Questions: 94
Total Answers: 109

Location: Western Sahara
Member since Sun, Nov 22, 2020
4 Years ago
;