Wherever possible, you should use
over window.location.href
, for a number of very good reasons.
- If you have javascript disabled, none of the links would work.
- Spiders, such as Google Bot, do not interpret javascript, and so they won't follow any of your links.
- IT BREAKS THE INTERNET. No, really though - the World Wide Web is built on the very basis of discoverable linkages between pages. Hiding these linkages with non-standard .. err, links, goes against that very premise.
- It makes for a bad user experience: a user expects that when they mouse over a link, they will have access to some information:
- the destination displayed in the status bar (very important!)
- right-click -> copy link location
- middle-click -> open new tab
- etc
- Using
window.location
breaks all of these
- It's much easier!