Reputation: 4383
I understand that there are ways to listen for a local [on the same computer] file being modified, moved, or deleted in python. However, there doesn't seem to be any easy way of telling if an html file has been opened by the browser, because javascript and html aren't capable of editing or locking files by themselves, as far as I can tell.
The only solution seems to be opening a websocket connected to the python application (even though python is running on the same computer) in javascript every-time the web page is opened, but I'm wondering if there is a better way, preferably one that doesn't "poll" and instead is event based since I have a large amount of files.
Upvotes: 0
Views: 356
Reputation: 592
I believe that you can send an ajax request to python when the page loads. If you are using a PHP backend, you can have PHP edit a file every time the page is loaded and you can then view this file using python.
Upvotes: 1