|
|
|
|
|
by z3t4
2249 days ago
|
|
You often have the dilemma whether something should be a link, or just a button. Links trigger a navigation to another page/URL, although in an "app" it could just render a new view rather then making a new browser request. A button is usually not a navigation, although it can render a new view and also have a unique URL. So the only difference is that you can right click and open in new tab on links, but not on buttons. And then you have to decide if you should style it like a button element or a:href element, where a:href signals to the user that they can right click and open in new tab, while a button does not. But you can also make an a:href look like a button, which can be considered an anti-pattern. Buttons do look nicer then links though. And buttons can also trigger a navigation, like in a form submit, but it's technically difficult to support submitting and open in new tab at the same time, because browsers have a hard separation between tabs, where one tab can't easily access another tab and vice versa. So while it's technically possible UX is often a matter of budget/laziness and stack/architecture. |
|
Simple rule is "should this view have a url". Should the user be able to navigate directly to this page? Should it exist in the history? Should the user be able to share a URL to that page to someone else? Most times the answer to all of these is.
In your javascript application, it is trivial to do single page app view navigations (without triggering a full browser request) by listening to link clicks and acting on it just as you would if it were a button click. All frameworks and routing libraries will handle this for you out of the box. If you roll your own, its not that difficult to add this functionality.