lioslios Posted January 19, 2012 Share Posted January 19, 2012 guys for some reson my browser lags on my page, but not in the start of use, but after i use the page for while, in every php file i use the <?php ob_start(); ......... ob_flush(); ob_end_clean(); ?> also in some submit buttons i have the header("location:someotherfile.php"); exit(); to call other pages is any other command that cleans the buffers or memory.. i think somthing like this is my problem im beginer with php any idea?? Quote Link to comment Share on other sites More sharing options...
Psycho Posted January 19, 2012 Share Posted January 19, 2012 PHP has nothing to do with how much memory the browser will use. All PHP code is processed on the web server. The only thing the browser 'sees' is the final content that is sent to the browser. A couple things to look for that might be causing browser memory issues: - Overcomplicated or very 'large' pages. Not very likely but I've seen issues many years ago where pages with lots of nested tables would cause problems. Especially if the tables were not properly created (i.e. missing closing tags). Most browsers are forgiving of some simple HTML structure errors, but to overcome them there would have to be some processing taking place. So, the more complicated the page with errors could cause problems. I've also seen problems with very large forms - hundreds of select fields with many/many options each. Again, this was years ago with PCs with a fraction of the memory of PCs used today. - JavaScript. I think this is a more likely cause. Are you running any JavaScript in a loop or is there any JavaScript running on mouseover/mouseout events or something like that? Or, are you running any AJAX on a timed event? Quote Link to comment Share on other sites More sharing options...
lioslios Posted January 19, 2012 Author Share Posted January 19, 2012 the only java script i use is this allert if($_SESSION['non_empty']==0) { echo "<script type='text/javascript'>alert('Παραλαλώ επιλέξτε πρώτα ένα είδος και μετά πατήστε οκ');</script>"; } forgot to mention and sorry for this, that the browser of android pad lags not the pc browsers but this android browser i testet dont lag in any other site! do you know any editor that can check my code for missing closing tags or some edit bugs thanks Quote Link to comment Share on other sites More sharing options...
Psycho Posted January 19, 2012 Share Posted January 19, 2012 Well, PHP would have nothing to do with this, but the fact that this is on an android could mean there are other causes I have not considered. If there is no JavaScript, other than that alert, then that is not the problem. I originally though that the complexity/size of the page was a long shot because PCs have improved so much in processing power and memory. But, since this is a tablet/phone that is definitely a possibility. You should also look at the amount of images and other "rich" content you have. For example, do you have a large image that you are resizing using the image height/width tags? If so, the device still has to download and hold that large image in memory regardless of the size settings you define. As for checking the html code you can use the W3C validator: http://validator.w3.org/ But, unless you have been writing good code you are going to get a lot of errors. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.