In my javascript code, in some point, i need to refresh the window (user has uploaded new image but in page still can see it)
i am wondering why is
location.href = location.href
not refreshing the window?
In my javascript code, in some point, i need to refresh the window (user has uploaded new image but in page still can see it)
i am wondering why is
location.href = location.href
not refreshing the window?
Share Improve this question edited Jan 21, 2016 at 3:15 shmosel 50.7k7 gold badges78 silver badges145 bronze badges asked Feb 23, 2012 at 14:24 Toni Michel CaubetToni Michel Caubet 20.2k58 gold badges217 silver badges387 bronze badges3 Answers
Reset to default 11To refresh the window try:
window.location.reload();
If you are wanting your to redirect your page, use:
window.location = location.href;
Or, if it is a simple case of refreshing the page:
window.location.reload();
if you really really need to refresh the page you should do
location.reload(true)