Reload page | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

Reload page

How can I reload the webpage in javascript? (share an example) I'm using the location.reload method but it's not working.

22nd Aug 2018, 5:57 PM
Moses Odhiambo
Moses Odhiambo - avatar
3 Answers
+ 1
Alex That won't work on chrome and mobile. (I'm not sure if it's only on my pc and cell phone) Do you have like a code example or something?
22nd Aug 2018, 7:21 PM
Moses Odhiambo
Moses Odhiambo - avatar
0
window.location.reload(true);
22nd Aug 2018, 6:51 PM
Alex
0
You should be able to simply try that command in the console of your browser (and it should reload the page). But if you want an example, here's one where it is used in a hyperlink: <a href="JavaScript:window.location.reload(true);">Reload Me</a> Sounds like the issue might be specific to your PC or browser. Sometimes a restart does the magic :) Good luck, and let us know the verdict.
22nd Aug 2018, 8:12 PM
Alex