Nick
Nick

Reputation: 4462

How to refresh page with a href in Firefox

I am using the following code to refresh my page using a link:

<a href="javascript:history.go(0)">

This works in Safari (i.e. the page is refreshed to the new content). In Firefox however I am getting the cached page. Is there a way of adapting this to work in all browsers, or do I need a different method?

Thanks,

Nick

Upvotes: 7

Views: 25856

Answers (2)

Nicholas Porter
Nicholas Porter

Reputation: 2951

You can just leave the href as empty and it will reload the current page.

<a href=''>Reload</a>

No need for onclick event or #.

Upvotes: 6

Pointy
Pointy

Reputation: 413709

You can use:

<a href='#' onclick='location.reload(true); return false;'>click me</a>

Upvotes: 16

Related Questions