admin管理员组

文章数量:1332865

I have a link to reload the page with JS:

<a href="#" onclick="location.reload()">Reload</a>

How do I stop page reload after the location.reload() method has been called?

I have a link to reload the page with JS:

<a href="#" onclick="location.reload()">Reload</a>

How do I stop page reload after the location.reload() method has been called?

Share edited Jul 6, 2016 at 11:44 sdvnksv asked Jul 6, 2016 at 11:34 sdvnksvsdvnksv 9,71819 gold badges63 silver badges119 bronze badges 4
  • 6 Somewhat confusing. Could you please elaborate it? – vijayP Commented Jul 6, 2016 at 11:37
  • can't you remove location.reload()? – Madhawa Priyashantha Commented Jul 6, 2016 at 11:42
  • @vijayP If you want to refresh the page in your browser, you can click the reload button. You can then stop the reload by clicking the stop reload button (the times icon). So the question was how do I stop page reloading with JS after the location.reload() method has been called. – sdvnksv Commented Jul 6, 2016 at 11:42
  • Possible duplicate of I want to stop the browser request, when user clicks on any button from UI, like stop button on browser – xxxmatko Commented Jul 6, 2016 at 12:04
Add a ment  | 

1 Answer 1

Reset to default 4

You can use the following code:

window.stop();

Beware: Microsoft Internet Explorer and Edge don't support it.

本文标签: javascriptStop reloading the page after locationreload() has been calledStack Overflow