简体   繁体   English

将网页重置为其初始状态

[英]reset webpage to its initial state

I have written a clear function which is supposed to clear map and combo box. 我写了一个清除功能,应该清除地图和组合框。 But I want to reset the webpage to its initial state. 但我想将网页重置为其初始状态。 I have tried APP.restart() 我已经尝试过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();
} 

But nothing works. 但是什么都行不通。 I do not need to reload function. 我不需要重新加载功能。 Can anyone tell how to reset the webpage to its initial state? 谁能告诉我如何将网页重置为其初始状态?

Follow any one of this: 请执行以下任一操作:

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

Example with jQuery: jQuery示例:

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

    });
</script>

See this link: reset webpage 查看此链接: 重置网页

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM