• witty_username@feddit.nl
    link
    fedilink
    English
    arrow-up
    11
    arrow-down
    1
    ·
    16 hours ago

    If I’d want to write a site with js-equivalent functionality and ux without using js, what would my options be?

    • Hellfire103@lemmy.caOP
      link
      fedilink
      English
      arrow-up
      3
      ·
      edit-2
      11 hours ago

      HTML and CSS can do quite a lot, and you can use PHP or cgi-bin for some scripting.

      Of course, it’s not a perfect alternative. JavaScript is sometimes the only option; but a website like the one I was trying to use could easily have just been a static site.

      • Possibly linux@lemmy.zip
        link
        fedilink
        English
        arrow-up
        1
        ·
        1 hour ago

        The problem is that HTML and CSS are extremely convoluted and unintuitive. They are the reason we don’t have more web engines.

    • dondelelcaro@lemmy.world
      link
      fedilink
      English
      arrow-up
      3
      arrow-down
      1
      ·
      11 hours ago

      htmx or equivalent technologies. The idea is to render as much as possible server side, and then use JS for the things that can’t be rendered there or require interactivity. And at the very least, serve the JS from your server, don’t leak requests to random CDNs.

      • XM34@feddit.org
        link
        fedilink
        English
        arrow-up
        3
        arrow-down
        1
        ·
        2 hours ago

        Htmx requires JS. At that point you already failed in the eyes of the purists. And CDNs exist for a reason. You can’t expect a website to guarantee perfect uptime and response times without the use of CDNs. And don’t get me started on how expensive it would be to host a globally requested website without a CDN. That’s a surefire way to get a million dollar bill from amazon!

      • unwarlikeExtortion@lemmy.ml
        link
        fedilink
        English
        arrow-up
        4
        ·
        edit-2
        15 hours ago

        You can’t modify the DOM.

        But some most dynamicity can stay - sites can be built freely server-side, and even some “dynamic” functionality like menus can be made using css pseudoclasses.

        Sure, you won’t have a Google Docs or Gmail webapp, but 90% of stuff doesn’t actually need one.

        A basic website doesn’t require js.

        A webshop, for example, does for the part around adding to cart and checkout - but it doesn’t for merely browsing.

        • dual_sport_dork 🐧🗡️@lemmy.world
          link
          fedilink
          English
          arrow-up
          3
          arrow-down
          1
          ·
          13 hours ago

          For a web store you probably only need Javascript for payment processing. Insofar as I’ve seen pretty much all of the widgets provided by the card processors outright require Javascript (and most of them are also exceedingly janky, regardless of what they look like on the outside to the user).

          You definitely don’t need Javascript just for a shopping cart, though. That can all be done server side.

    • TrickDacy@lemmy.world
      link
      fedilink
      English
      arrow-up
      1
      arrow-down
      3
      ·
      14 hours ago

      I mean you could build a site in next.js, ironically. Which is very counter intuitive because it literally is js you are writing, but you can write it to not do dynamic things so it effectively would be a static server rendered site that, if js is enabled, gets for free things like a loader bar and quick navigation transitions. If js is disabled it functions just like a standard static site.