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
3 Answers
Reset to default 4try 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()
});