How do I make Firefox auto-refresh on file change?

前端 未结 10 614
半阙折子戏
半阙折子戏 2020-11-29 18:43

Does anyone know of an extension for Firefox, or a script or some other mechanism, that can monitor one or more local files. Firefox would auto-refresh or otherwise update i

相关标签:
10条回答
  • 2020-11-29 19:03

    I think that you can solve it by using some ajax requests after a determinate interval. You can do a request to CSS files and then if you don't get the "not modified" header you delete your css and load it again. For dynamic files you do a request and store the response and then every time you make a request to that file you compare the response to the latest.

    0 讨论(0)
  • 2020-11-29 19:06

    There are some IDE's that contain this ability (They'll have a pane within them or some other means to auto-refresh a page on save).

    If you want to do this yourself a quick hack is to set the meta refresh on the page to a low value - one or two seconds.

    # Will refresh the page content every second
    <meta http-equiv="refresh" content="1" />
    
    0 讨论(0)
  • 2020-11-29 19:08

    Have a look at FileWatcher extension: https://addons.mozilla.org/en-US/firefox/addon/filewatcher/

    • it's a WebExtension, so it works with the latest Firefox
    • it has a native app (to be installed locally) that monitors watched files for changes using native OS calls (no polling!) and notifies the WebExtension to let it reload the web page
    • reload is driven by rules: a rule contains the page URL (with regular expression support) and its included/excluded local source files
    • open source: https://github.com/coolsoft-ita/filewatcher

    DISCLAIMER: I'm the author of the extension ;)

    0 讨论(0)
  • 2020-11-29 19:22

    Xrefresh with firebug.

    0 讨论(0)
提交回复
热议问题