Continiously Tail A Local File For New Lines Using Javascript In A Browser
I have a file that gets new lines appended to it frequently. I want to create a web application running in the browser using javascript that will be able to detect changes on that
Solution 1:
You can use js-logtail for following files like tail -f :
<head>
<title>habitat parser log viewer</title>
<script type="text/javascript" src="jquery.min.js"></script>
<script type="text/javascript" src="logtail.js"></script>
<link href="logtail.css" type="text/css">
</head>
<body>
<div id="header">
js-logtail.
<a href="./">Reversed</a> or
<a href="./?noreverse">chronological</a> view.
<a id="pause" href='#'>Pause</a>.
</div>
<pre id="data">Loading...</pre>
</body>
You don't even need a server side part, the webserver (as apache, lighthttpd) handles this with the HTTP Range header internally.
Post a Comment for "Continiously Tail A Local File For New Lines Using Javascript In A Browser"