In many web applications built with ASP.NET templates (new and old) there is a link at the top-left which is a link to the homepage of the site.
what I typically do is add some onclick logic to disable the click if we are already on the homepage to avoid unnecessary or errant page
reloads.
Basically: Don't try to navigate to an address if I am already there.
<a href="/" onclick="return this.href!==location.href" class="navbar-brand" title="My New App">My App</a>
This code will prevent the click if the target href is the same as the href of the current location.
onclick="return this.href!==location.href"
Question: Can I do this at the document, window or location level instead of on each and every link?
I use this sparingly now, but it would be nice to paint with a broader brush.