In current page, add button "Refresh"
Process: when user click this button "Refresh", then this page link "https://abc.io/123" refreshed and do not open this link (not new page), still sttay on current page.
My code don't work:
<a href="https://abc.io/123" onClick="window.location.reload();return false;">
<i class="fas fa-sync-alt fa-1.5x" aria-hidden="true" style="color:#0000FF;"></i><span style="color:blue;"> Refresh</span>
</a>
How can do it?
Thanks
First of all onClick
should be onclick
. This will reload the page, except if the DOMException gets thrown, which blocks the reload. You can read more about it here . By default, the page gets reloaded from the browser cache. To force reload it from the server, pass true
to window.location.reload()
.
<a href="https://abc.io/123" onclick="window.location.reload(); return false;"> <i class="fas fa-sync-alt fa-1.5x" aria-hidden="true" style="color:#0000FF;"></i><span style="color:blue;"> Refresh</span> </a>
If you intend to open the link as well, return true
from the onclick function.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.