I have a JavaScript app where the method location.reload() is used. The method location.reload()
is in a onclick
event handler to reset the page, and this answer says that you need to return false;
after location.reload()
with onclick
: How to reload a page using JavaScript.
location.reload();See this MDN page for more information.
If you are refreshing after an
onclick
then you'll need to return false directly afterlocation.reload(); return false;
Why should you return false;
after method location.reload()
using onclick
?
<a>
elements or form submission? – Chloe Andersonreturn false
after the reload is necessary. I also thought they were talking about the answer of passingfalse
to.reload
at first glance. @FilipHuhta - for what it's worth, there are a few comments challenging/questioning this assertion regarding returningfalse
on that answer. – Alexander Nied