Skip to content Skip to sidebar Skip to footer

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><scripttype="text/javascript"src="jquery.min.js"></script><scripttype="text/javascript"src="logtail.js"></script><linkhref="logtail.css"type="text/css"></head><body><divid="header">
        js-logtail.
        <ahref="./">Reversed</a> or
        <ahref="./?noreverse">chronological</a> view.
        <aid="pause"href='#'>Pause</a>.
    </div><preid="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"