代码之家  ›  专栏  ›  技术社区  ›  ffConundrums

在mac上使用nwjs刷新硬浏览器

  •  2
  • ffConundrums  · 技术社区  · 6 年前

    在Mac上用NWJS运行应用程序时,有没有办法进行硬浏览器刷新?nwjs右键单击“Simulate Browser Restart”似乎再次在其入口点启动应用程序。有没有一种方法来模拟简单地点击Chrome中的换档重新加载按钮的行为?

    2 回复  |  直到 6 年前
        1
  •  2
  •   ffConundrums    6 年前

    有一个用于此的nwjs api:

    // Load native UI library
    var ngui = require('nw.gui');
    // Get the current window
    var nwin = ngui.Window.get();
    // this will do a hard refresh
    nwin.reloadIgnoringCache();
    
    // here's a regular refresh
     nwin.reload();
    

    NWJS文件:

    http://docs.nwjs.io/en/latest/References/Window/#winreloadignoringcache

        2
  •  0
  •   004123    6 年前

    只需使用JavaScript重新加载

    location.reload();
    
    推荐文章