最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Reload a page without prompt message - Stack Overflow

programmeradmin1浏览0评论

I am trying to reload page. But getting prompt message.

location.reload();

$window.location.reload();

Is there a way to reload page without prompting a message?

I am trying to reload page. But getting prompt message.

location.reload();

$window.location.reload();

Is there a way to reload page without prompting a message?

Share Improve this question asked Mar 8, 2018 at 6:23 Nagarjuna ReddyNagarjuna Reddy 4,19514 gold badges46 silver badges87 bronze badges 8
  • location.reload(); works without prompt message on chrome for me – Nitin Dhomse Commented Mar 8, 2018 at 6:26
  • I don't get a prompt message with location.reload() either. What does the message say? – jeanl Commented Mar 8, 2018 at 6:27
  • can you tell us what the prompt message says? – EKW Commented Mar 8, 2018 at 6:28
  • what prompt you are getting. If the current page opened by posting the form on previous page, its browser functionality to prompt the user before resubmitting the page again if you try to do so.. – Deepak Sharma Commented Mar 8, 2018 at 6:29
  • What browser are you using? Tried in chrome and ie and no prompt. – DannyMoshe Commented Mar 8, 2018 at 6:29
 |  Show 3 more ments

3 Answers 3

Reset to default 4

try using window.onbeforeunload = null; before window.location.reload().

You can use window.location = window.location.href;

In Jquery simply use -

  $(selector).click(function(e) {
    e.preventDefault();
    $(window).off('beforeunload');
    window.location.reload()
  });
发布评论

评论列表(0)

  1. 暂无评论