Reload browser window after POST without prompting user to resend POST data

后端 未结 14 2014
盖世英雄少女心
盖世英雄少女心 2020-11-29 05:47

When a user visits my website there is a \"Login\" link on every page. Clicking this uses some JavaScript to show an overlay window where the user is prompted for their cred

相关标签:
14条回答
  • 2020-11-29 06:20

    You can take advantage of the HTML prompt to unload mechanism, by specifying no unload handler:

    window.onbeforeunload = null;
    window.location.replace(URL);
    

    See the notes section of the WindowEventHandlers.onbeforeunload for more information.

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

    You could try to create an empty form, method=get, and submitting it.

    <form id='reloader' method='get' action="enter url here"> </form>
    <script>
    // to reload the page, try
    document.getElementById('reloader').submit();
    </script>
    
    0 讨论(0)
提交回复
热议问题