There are a number of reasons why a browser request is preferable to a page reload:
a reload can lead to a page flash (or worse). For micro-interactions, that would be very annoying
a reload causes substantially more network traffic (even if some resources can be fetched from the browser cache)
a reload recomposes/rebuilds the page from its resources (html, css, images, ...) and inherently causes a full redraw of the page, even if e.g. only the ❤️has changed
a reload discards the previous page, which means that those system resources need to be cleaned up, and that they remain unavailable until that has been done
Aside from those pragmatic reasons:
A reload does not respect separation of concerns, since you essentially have a god-method that Does All The Things(TM) rather than confining itself to the necessary scope (such as reacting to a ❤️click).
From the point of view of the user of the UI: because I can read and interact with the application on different laptops, PCs, tablets and smartphones, and all I need is one ubiquitous kind of application (i.e. a web browser) and my login credentials.
From the point of view of the creator of the UI: because I can create an application that people can read and interact with on different laptops, PCs, tablets and smartphones, without me needing to make and maintain separate applications for all those types of hardware.
Cross-platform development exists - and targeting different operating systems is much less error-prone than targeting different web browsers. Heck, Firefox 62 renders stuff differently than Firefox 61! And this should be "easier" to do right?
Fair enough, but that such differences in rendering typically result in having an imperfect but quite usable web app on pretty much all modern browsers (unless you're doing really fancy things). So you immediately cast a very wide net.
For cross-platform (say the latest few Windows versions, the most prevalent linux distros, OSX and IOS, android - nothing exotic), you have to actively account for each of those groups, and make sure that executables or installers are available, including distributing updates. It's perfectly doable of course, but it's very much not in the same category of effort as a web app.
it's very much not in the same category of effort as a web app.
Because you'll have to adjust your "web app" twice a year because of moving standards while your desktop application can, in theory, still be used in ten years.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
There are a number of reasons why a browser request is preferable to a page reload:
Aside from those pragmatic reasons:
If you absolutely need any of those UX features, why don't you just write a desktop application instead?
From the point of view of the user of the UI: because I can read and interact with the application on different laptops, PCs, tablets and smartphones, and all I need is one ubiquitous kind of application (i.e. a web browser) and my login credentials.
From the point of view of the creator of the UI: because I can create an application that people can read and interact with on different laptops, PCs, tablets and smartphones, without me needing to make and maintain separate applications for all those types of hardware.
Cross-platform development exists - and targeting different operating systems is much less error-prone than targeting different web browsers. Heck, Firefox 62 renders stuff differently than Firefox 61! And this should be "easier" to do right?
Fair enough, but that such differences in rendering typically result in having an imperfect but quite usable web app on pretty much all modern browsers (unless you're doing really fancy things). So you immediately cast a very wide net.
For cross-platform (say the latest few Windows versions, the most prevalent linux distros, OSX and IOS, android - nothing exotic), you have to actively account for each of those groups, and make sure that executables or installers are available, including distributing updates. It's perfectly doable of course, but it's very much not in the same category of effort as a web app.
Because you'll have to adjust your "web app" twice a year because of moving standards while your desktop application can, in theory, still be used in ten years.