2017-07-26 77 views
2

我已經寫了一個清除地圖和組合框的功能。但我想將網頁重置爲初始狀態。我已經試過APP.restart()將網頁重置爲其初始狀態

App.restart = function() { 
     var child, 
     child_process = require("child_process"), 
     gui = require('nw.gui'), 
     win = gui.Window.get(); 
     if (process.platform == "darwin") { 
      child = child_process.spawn("open", ["-n", "-a", process.execPath.match(/^([^\0]+?\.app)\//)[1]], {detached:true}); 
     } else { 
      child = child_process.spawn(process.execPath, [], {detached: true}); 
     } 
     child.unref(); 
     win.hide(); 
     gui.App.quit(); 
} 

但是沒有什麼效果。 我不需要重新加載功能。任何人都可以告訴如何重置網頁到其初始狀態?

回答

0

跟隨的這個任一項:

1.Prevent page from caching (with response headers from server); 
2.Clear all fields each time page is loaded with Javascript. 

實施例與jQuery:

<script> 
    $(document).ready(function(){ 
     $('your_form_input_fields_id').val(''); 

    }); 
</script> 

請參閱此鏈接:reset webpage

+0

它不是一種形式。這是網頁顯示地圖 –

+0

你可以看到這個答案: https://stackoverflow.com/questions/35157926/google-map-reset-to-initial-state –