WP.org acceptable iframe alternative

Use JavaScript to poll for new data at an interval and update the DOM as it comes in. Downloading the complete log file at intervals would be very inefficient and quite likely consume a huge amount of bandwidth. Instead, use some server-side code to determine if new data is available and if so return that in the response.

For instance, the client could send some information about the last lines it received – say the time at which it last received new data, and the largest line number it already has. The server can then check if the file’s modified time is greater than the time at which the client last received data, and if so, open the file and send any new lines to the client.

WordPress’s AJAX handlers would be a fine way to implement the JS<=>WordPress communications. The Plugin Handbook’s page on AJAX, and the Codex’s “AJAX in Plugins” page are good places to start.

The Mozilla Developer Network has a nice intro on DOM manipulation via JS (among many other guides), but otherwise the subject matter in isolation is outside the scope of this Stack.

tech