came across some twitter banter about how terrible it is to use
javascript:history.go(-1)
of course without any hints as to why.
If it's so terrible, why? What's the alternative? (besides history.back(), which seems to do exact same thing). Is it a matter of cross browser compatibility?
For example, I've seen it used on an error page to let users try to "go back" using the above.
I've tried google, but an no avail, in regards to why it'd be so horrible to use. Any pointers/explanations would be appreciated.
Thanks.
They may have been referring to use of the pseudo protocol javascript:
, which generally means this is an anchor's href
attribute, which is ugly. It is not a real link, and with JavaScript disabled, it'll do nothing whilst looking like a functional link. I think the only valid use for this protocol is for bookmarklets.
Also, as Russell Dias points out, it does exactly the same as the back button, so what is the point of having it? Should we have a reload button too that calls window.location.reload()
?
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