Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I'm working on an application that creates HTML log files. I'm tired of having to manually reload and scroll to the bottom in the browser to see the latest entries.

A solution that does not really satisfy me is using the Firefox plugins ReloadEvery and ScrollyFox. In many situations reloading frequency and scrolling speed are just to slow.

Of course I could actually use tail, but I would prefer a rendered HTML page.

Do you have any suggestions? Firefox extensions are preferred, but any other tip is appreciated, too.

share|improve this question
    
If you're in control of the HTML log file creation, you could inject a piece of javascript which refreshes itself using AJAX calls. It may be possible to then find new content, and append it directly in the current HTML, with no visible refresh / scrolling. I guess you could even make this a greasemonkey script, if you don't have control of the source. –  Daniel B Oct 4 '12 at 11:55
    
@DanielB Taking this route I could simply add reload/scroll polling using Javascript directly in the log file. And this wouldn't be such a bad idea, I think. Thanks for your thoughts. –  h0b0 Oct 4 '12 at 12:02
add comment

1 Answer

If there is a possibility to control the log structure - one possible solution would be to add an anchor such as:

<a name='end' />

just above </body> tag and then access the log using log.html#end - which coupled with an auto-refresh functionality (either by using a meta tag, JavaScript or a Firefox extension).

share|improve this answer
    
I like the idea, but unfortunately there is no </body> tag. The file is actually broken. But by omitting the closing tags it is possible to add lines to the log without problems. This is one of the few occasions when the great tolerance of browsers towards broken HTML comes really handy. –  h0b0 Oct 9 '12 at 7:51
    
Actually this should work even if you just place the anchor at the bottom of the page. The only restriction is that there should be only one such anchor. This is, BTW, yet another instance of the fore-mentioned browser tolerance of broken HTML. –  Drag0nR3b0rn Oct 12 '12 at 13:07
    
As I sad before: I cannot ad any closing tags that would have to be removed before adding a new log entry. –  h0b0 Oct 15 '12 at 6:54
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.