Page 1 of 1

output buffering w/ browser tracking?

Posted: Mon Apr 10, 2006 4:51 am
by malcolmboston
im using output buffering to basically traverse through a long loop which takes an age to complete

ive come to the conclusion i need to use OB so...

all thats working nicely however i would like the browser to go to the bottom result at every reload, im guessing i need to use an anchor tag but am unsure on how to implement it in this situation...

any ideas guys?

Posted: Mon Apr 10, 2006 6:16 am
by s.dot
You could try javascript using document.elementID.scrollintoview(false);

Posted: Mon Apr 10, 2006 6:19 am
by s.dot
errr actually I think you could leave out the false part

Posted: Tue Apr 11, 2006 3:55 am
by malcolmboston
any non-js implementations, i need to keep this light

Posted: Tue Apr 11, 2006 5:21 am
by Maugrim_The_Reaper
JS is the only method I can think of for manipulating a browser view. An anchor tag might work if set at the bottom of the page - you should set up a quick test, maybe loop through a few dozen lines of text, append anchor, print to browser - see what happens.

Posted: Tue Apr 11, 2006 6:46 am
by s.dot
I just did something like this... it appears to be pretty "light"
I also have a barbaric knowledge of javascript, so there's probably a better way to do it.

Code: Select all

<html>
<head>
<title>Test</title>
</head>
<body>
<div id="scroll">
<?php


for($i=0;$i<1000;$i++){
	echo $i."<br />";
	usleep(100000);		//	added just to make the auto scroll look better
	?>
	
	<script type="text/javascript">
	document.getElementById('scroll').scrollIntoView(false);
	</script>
	
	<?php
}

?>
</div>
</body>
</html>