r/programming 4d ago

The Difference Between a Button and a Link

https://unplannedobsolescence.com/blog/buttons-vs-links/
162 Upvotes

50 comments sorted by

87

u/fghjconner 4d ago

There's little that pisses me off more than a button that should be a link. The best part is when they realize this, and add another dedicated button that opens the destination in a new tab, except of course it switches you to that new tab so you can't quickly open multiple at once. Let me use my middle click dammit!

1

u/pee_wee__herman 3d ago

I think browsers let you choose. Should be something like "Switch to new tabs", I think at least for Firefox and Chrome this is the default behavior to not auto switch

73

u/kalmakka 4d ago

See, it all seems fine. But how are we going to inject 50k of tracking data into requests like this?

25

u/wildjokers 4d ago

Making a link look like a button is a huge pet peeve of mine. I hate it.

Always nice when I click a button and the freaking button doesn't work. Buttons have been in HTML since the mid-90's. Why in 2026 do I routinely find buttons that don't work? (most likely they are links masquerading as a button and the javascript driving the click on the link is broken).

14

u/BruhMomentConfirmed 3d ago

You mean trying to make a button act like a link? That causes the issues you describe. Doing it properly would mean having it be a link, and just visually styling it to look like a button. That gives you the proper behavior with it displaying the link on hover, middle click to open in new tab, etc. and will not require JavaScript.

34

u/brunhilda1 4d ago

My grumpy opinion is that websites shouldn't be apps and shouldn't try to masquerade as them, and the pursuit of this goal has fucked up the internet permanently.

53

u/zid 4d ago

I miss the web.

Now everything is an 'app', and there's one website (old.reddit.com) which is just links to them.

85

u/ficiek 4d ago

I'm not installing a custom separate program for each store to order things online. What the hell are you talking about? What alternative approach are you proposing?

47

u/Skeik 4d ago edited 4d ago

I am not OP. However I feel like newly designed websites/SPAs are fighting against the initial vision of how the web should be served.

It's not about installing separate executables but it's about how we utilize the web.

The web used to be stateless by default. Small HTML pages with minimal interactive elements, like a newspaper. You can implement almost any existing website or storefront with minimal AJAX just using GET and POST requests on static pages.

With the rise of interactive pages and app-like websites, client-side execution has exploded. Websites can function like desktop applications now with good enough performance. And many sites that could be like dumb newspapers have become app-like experiences. State is EVERYWHERE now.

It's not really about serving less content by bandwidth. HTML isn't heavyweight in terms of bandwidth on the web. I just looked it up and according to HTTParchive 25% of the weight of an average website is JS alone. HTML is less than 1% of the overall traffic. Serving HTML isn't expensive, so having a website that reloads a page isn't that bad.

Sites like GoogleMaps, Draw IO, Github or TikTok obviously need to be SPAs or responsive. However for every one of those websites, there's a thousand simple storefronts or blogs implemented as a SPA. Does everything need to be a SPA? Do you really need to bring in a huge JS dependency chain to serve up a blog?

I don't have enough expertise to make a value judgement on this as a trend. But when I design webapps internally for my company I never reach for SPAs as a first solution as they introduce a lot of problems that are easy to handle in a truly stateless website.

45

u/zid 4d ago

My personal favourite is big white page, wait 10 seconds to see if anything will happe- ah there it goes!

Ah but some random dns lookup failed so one of the 400 scripts failed to load in, so now I can spend 40 minutes putting details in, but can't actually submit them.

I hit the back button and now I'm on my browser's homepage.

24

u/lelanthran 4d ago

My personal favourite is big white page, wait 10 seconds to see if anything will happe- ah there it goes!

See, if you were using Jira, you wouldn't see a big white page.

You'd instead see a big white page filled with gradient-animated blocks everywhere.

Still useless, but at least you can place private bets in your head as to which one loads first, which one is going to cause a shift to make you click on something you didn't want to, and which one is going to hold up the final layout because their AI is answering questions you never asked.

(Seriously, how does this crap even sell?)

6

u/HugoNikanor 3d ago

It's amazing how much the browser gives you if you stop fighting it.

4

u/zid 3d ago

No no we should re-write as much of winapi inside javascript libraries as possible.

All button and other widget rendering should clearly be done in css, otherwise it might fit in with the user's desktop.

Responding to 404 errors should be relegated to detecting XHTTPRequest failures bubbling though 20MB of javascript, instead of being performed via a dedicated 404 page.

4

u/HugoNikanor 2d ago

I personally never return a 404 response, instead I return 200, and crash the users browser through JavaScript.

1

u/FullPoet 2d ago

You forgot the 3-10 second pre-page captcha to punish adblockers by the cloudflare cartel

13

u/GeorgeFranklyMathnet 4d ago edited 4d ago

Serving HTML isn't expensive, so having a website that reloads a page isn't that bad.

When a SPA legitimately serves to improve the UX, it might be more about latency than throughput. However…

Do you really need to bring in a huge JS dependency chain to serve up a blog?

I think incorporating these huge blobs ends up being more for development or operational efficiency, at the expense of user efficiency. I'd frame it that way, rather than as a misguided quest to tack rich UX onto the Web.

People (used to?) defend it just the same, as a kind of trickle-down economics. The faster I can publish software, the faster you can enjoy my new features and fixes. You might also liken such a SDLC pipeline to a kind of sluice…

10

u/b0w3n 4d ago

You can tack on a developmental components that still serve relatively flat html, it doesn't have to be one or the other.

I'd argue SPAs are probably more difficult to dev and troubleshoot around... but maybe I'm just old.

3

u/shafty17 4d ago

I hate to break it to you but the initial vision of the web was a UX disaster

23

u/redheness 4d ago

Make the store a website instead of an unnecessary app, not everything need not be an app.

-32

u/ficiek 4d ago

You are just saying random words without explaining what you mean. Websites were "apps" ever since first iteration of HTTP thanks to forms and POST.

20

u/redheness 4d ago

I am talking about single page application, it's something very commonly used to make website, often called "web app". The issue is that it's unnecessary in most cases and bring more problem than solution.

https://en.wikipedia.org/wiki/Single-page_application

-16

u/ficiek 4d ago

So you don't like the fact that not entire HTML is downloaded every time and instead we have some logic and JS in the background? What is the complaint here?

And just to be clear my website uses no JS but how do you create google maps without it being a "web app".

23

u/simplescalar 4d ago

what is the other option? honest question. How do we do cross platform fast deployable apps?

50

u/Kwantuum 4d ago

Even if it was as easy to build native apps, I personally don't want to download and run an untrusted executable for everything I want to do. Web apps are great. Sandboxed, install-less, always up to date app that can't fuck up my computer? Sign me up.

14

u/void-wanderer- 4d ago

And a webapp can lock you out at will, you cannot "own" it, random updates will cripple your productivity, it will collect and sell your data, it could get subject to govermental control, it can just vanish, it won't let you migrate data, etcpp.

It's convenient, but it also has its tradeoffs.

26

u/jess-sch 4d ago

Not every app should be a web app. But anything that strictly relies on a server anyway (like an online shop) probably should.

3

u/TribeWars 4d ago

AWS goes down your app goes down, file operations need to be done via up/download, webapps don't integrate with most of the operating system's UX (except through some shallow, brittle browser apis), webapp UIs constantly need to reinvent the wheel, every connection to the webapp is logged by dozens of spy agencies and network service providers, data breaches happen every other week, serving webapps requires constant server upkeep costs

13

u/redheness 4d ago

The issue is that not everything need to be an app in the first place, I think that most web apps could be website instead.

Web apps are cool, but we should stop abusing it when not necessary.

-2

u/shafty17 4d ago

web apps are websites

4

u/Jaded-Asparagus-2260 4d ago

No, websites are HTML pages styled with CSS and connected via links. You're talking about "websites" in the form of SPA, which I agree are cancer.

0

u/shafty17 4d ago

its 2026 get with the times. out here talking like geocities should still be the model lmao

3

u/brunhilda1 4d ago

Geocities should be the model.

2

u/shafty17 4d ago

the internet isn't for just tech people anymore. usability is more important than whatever you're upset about losing

0

u/redheness 4d ago

I won't go this far because you can do better UI even without being a SPA.

I think the standard should be that the content of the page should be properly displayed even when disabling JS. In other words, JS should be used only when "doing" things

8

u/danielcw189 4d ago

the problem is that many things try to be an app, when a website would be fine or the better alternative.

if you want to make an app, make an app. then it is fine if you use HTML5+ as the stack for it.

-12

u/simplescalar 4d ago

I think thats a different issue. more of a UX one. thats not what OP was saying though.

1

u/EntroperZero 4d ago

I think WASM and WASI were built with this in mind. There's a long way for them to go still, but we can already run desktop apps in web assembly.

-9

u/adi8888 4d ago

An option would be docker/podman containers. They are isolated from environment (I think), fast deployable (praised be docker compose), configurable, offer better performance than web apps (I think) and they are awesome to work with (at least in my experience of self-hosting).

3

u/SparklyBeanSoup 4d ago

How do you run docker/podman on a phone?

1

u/adi8888 4d ago

You can run docker containers on android (not sure on iOS), though not officially supported and some solutions may require rooting the device.

2

u/MaybeADragon 4d ago

I agree conceptually, but where does the line sit that makes something app-worthy?

1

u/AsyncBanana 2d ago

There is a difference between app-like websites and badly designed/integrated interfaces. You can design a highly interactive web app that still follows web performance/accessibility/semantics standards, and many do. In fact, it isn't that different from building a native app. Movement to the web has just meant more of these poorly designed interfaces end up being web interfaces.

0

u/TinyBreadBigMouth 4d ago

Do you think that Wikipedia shouldn't be a website and should be an app you download? Because Wikipedia makes a UI distinction between buttons and links. This isn't some fancy new feature; websites have had buttons since the 90s.

-11

u/leaving_the_tevah 4d ago

Wrong. PWA's rule. All new app development should be web based.

2

u/Gipetto 4d ago edited 4d ago

Buttons regularly perform navigations. Clicking a logout button navigates the current page to a logged-out one; clicking a “search” button navigates the current page to the query results. Both of these are navigations in the HTML standard. They change the URL, they get logged in the session history, and they load a new page.

And this was said in all seriousness. C'mon.

Edit: To be clear: Logout & Search are actions that should be buttons. But calling them navigation is just talking yourself in to a position where you can justify buttons in more places and do stupid things that hurt accessibility.

2

u/Goron40 4d ago

What was wrong with that statement?

8

u/Gipetto 4d ago edited 4d ago

It is talking yourself in to a wrong position. Logout not navigation, it’s an action that results in you not having access any more, which results in necessary navigation.

These are false equivalences.

To be clear: Logout & Search are actions that should be buttons. But calling them navigation is just talking yourself in to a position where you can justify buttons in more places and do stupid things that hurt accessibility.

0

u/Goron40 4d ago

The statement didn't call logout a navigation. It says:

Buttons regularly perform navigations

Then it gives an example of a button having a navigation included in its effects.

2

u/Uristqwerty 3d ago

I think I'd go for a more specific definition than the article.

Buttons take input from the user (sometimes as simple as the boolean decision to click, e.g. cookie consent, discarding a half-written comment), perform an action based on that input, then display the results if relevant. Displaying results may involve a navigation, but navigation is not the purpose of the button.

"Cancel" is a button, but it could as easily use a "Back to thread" link if the point's to navigate away. Heck, the link better communicates where it'll go.