Toni Michel Caubet
Toni Michel Caubet

Reputation: 20163

location.href = location.href wont redirect

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?

Upvotes: 4

Views: 7909

Answers (3)

Neil Knight
Neil Knight

Reputation: 48547

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();

Upvotes: 9

Nicola Peluchetti
Nicola Peluchetti

Reputation: 76880

if you really really need to refresh the page you should do

 location.reload(true)

Upvotes: 2

Rory McCrossan
Rory McCrossan

Reputation: 337560

To refresh the window try:

window.location.reload();

Upvotes: 11

Related Questions