I was going through a website I've taken over and came across this section in one of the pages:
<a href="javascript:window.location='<%=GetSignOutUrl()%>';">
// img
</a>
Apparently anyone who has ever used the site without javascript would not be able to log out properly (surprisingly enough, this has never come up).
So the first thing that comes to mind is
<a href="<%=GetSignOutUrl()" onclick="javascript:window.location='<%=GetSignOutUrl()%>';">
// img
</a>
Then I realized I don't know why I'm keeping the javascript call around at all. I'm just a little confused as to why it would have been written like that in the first place when a regular link would have worked just fine. What benefit does window.location have over just a regular link?
This is also the only place in the website I've seen something like this done (so far).
Edit: The programmer before me was highly competent, which is actually why I was wondering if there was something I wasn't taking into account or if he just made a simple oversight.
There are three possibilites:
I would remove it and see if it breaks. But then again, I'm a conformist.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With