Web Development

Rick_C137 OP , in nginx, Default server do not works ! [solved]
@Rick_C137@programming.dev avatar

ok I've found something that ~works !

	server {
		listen 443 ssl;
		server_name _;
		ssl_certificate /etc/nginx/ssl/catchall.crt;
		ssl_certificate_key /etc/nginx/ssl/catchall.key;

		error_page 404 /404.html; #at /var/www/html/

		location /404.html {internal;}

		return 404;
	}

so i get the default 404 html from nginx. but not the one that I specified error_page 404 /404.html;
any ideas ?

Rick_C137 OP ,
@Rick_C137@programming.dev avatar

The full working code:

server {
    listen 443 ssl;
    server_name _;
    ssl_certificate /etc/nginx/ssl/catchall.crt;
    ssl_certificate_key /etc/nginx/ssl/catchall.key;

    error_page 404 /404_CatchAll.html;

    # Everything is a 404
    location / {
        return 404;
    }

    location /404_CatchAll.html {root /var/www/html/;}
}
NegativeLookBehind , in nginx, Default server do not works ! [solved]
@NegativeLookBehind@lemmy.world avatar

Just guessing, but should it be pointing at 404.txt, not /404.txt

Rick_C137 OP ,
@Rick_C137@programming.dev avatar

line 5 you mean ?

error_page 404 /404.html; #this one ?
aluminium , in Google no longer developing Material Web Components

It sucks for people using it, but I'm glad. Material 3 is an abomination i.m.o.

moon , in Google no longer developing Material Web Components

Pretty sure I only actually saw it being used by Google anyways. I love it for native applications on Android, but couldn't care less about it on the web.

onlinepersona , in Infinite-Scrolling Logos In Single HTML Container And Pure CSS

Why in the world was marquee removed? It probably does a better job at scrolling than CSS. Look at everything that had to be written just to mimic a fraction of its power!

To make it efficient, you'd also have to add and remove elements out of sight to save memory. Pure CSS doesn't do that.

Anti Commercial-AI license

spartanatreyu , in Is it possible to get the value of a CSS property in an HTML element, using XPath 1.0?
@spartanatreyu@programming.dev avatar

Asking just because I'm curious... why are you using xpath?

Also, is this for a website you control or for some else's website?

If you're rendering the page (in a browser, e2e test-runner, spider bot, etc...), have you considered running some js on the page to get the image? Something like: const imagePath = document.getElementById('exampleIdOnElement').style.backgroundImage

Kalcifer OP ,
@Kalcifer@sh.itjust.works avatar

Asking just because I’m curious… why are you using xpath?

I'm using a service called FreshRSS that automatically fetches RSS feeds. It has a feature that allows you to create custom feeds for sites by scraping the HTML with user specified XPath expressions.

I know that this isn't exactly "web development", but it uses webdev tools, and I wasn't entirely sure where else to post this.

If you’re rendering the page (in a browser, e2e test-runner, spider bot, etc…), have you considered running some js on the page to get the image? Something like: const imagePath = document.getElementById('exampleIdOnElement').style.backgroundImage

JS is, unfortunately, not possible here. I can only use XPath expressions.

Maddier1993 , in You would think it would be easier for Canadians to get sponsorship

For decades, outsourcing was happening to India and other east asian countries to cut costs. This happened even under low interest rate for loans.

Now that interests are higher the cost cutting and outsourcing only increase.

My own feelings are that we really should figure out if we want to work for such lowballers who cut us off like parasites at the first sign of trouble.

It would be prudent for workers to seek work in smaller, private companies. While they have the risk of going bust... they're hopefully not laying off people in the same breath as announcing record growth.

Ember_Rising , in XMLHttpRequest (XHR) Vs Fetch API

Also, you can use Wretch for a really neat builder pattern to make requests.

https://elbywan.github.io/wretch/

walter_wiggles , in XMLHttpRequest (XHR) Vs Fetch API

I think of XHR as more of a low-level API. Most of the time though you don't need access to those low-level details.

The fetch API is bit higher level and nicer to work with.

mozz Admin , in Anyone able to help with my website being slow to certain sections?
mozz avatar

Can you show a screenshot of the waterfall display while loading with a fresh cache / without the fresh cache?

mac OP ,
@mac@infosec.pub avatar

I looked at the waterfall and I realised I had some design images in there at 2500+ resolution that were taking 5s to load and that was interfering with the loading of the JS.

Thanks, I'll make sure to check this tab first before posting next time.

mozz Admin ,
mozz avatar

All good 👍🏻

MrPoopyButthole , in Node Authentication With Passport.Js
@MrPoopyButthole@lemmy.world avatar

I thought passport was abandonware

shnizmuffin , in HTML: A Comprehensive Guide - Chapter One
@shnizmuffin@lemmy.inbutts.lol avatar

Web accessibility isn't just about compliance; it's about creating digital experiences that empower and include every user, regardless of their abilities.

Step 1: remove user agency.

<html lang="en">
  <head>
    <base target="_blank" />
  </head>

I get that it's hard to come up with a good example of using <base>, but I wouldn't show a user-hostile example before ... cutting the element from Chapter 1 entirely. The only time I've ever used <base> was when I had to deploy multiple versions of a multi-page static site to a subdirectory for its staging environment, but to the public root for the production environment. Even then, the solution wasn't, "use <base>," it was, "sort shit out later with nginx."

Step 2: confuse the use case of anchors and buttons.

  <body>
    <ul>
      <li><a class="native" href="add-book">Add Book</a></li>
      <li><a class="native" href="view">View Bookshelf</a></li>
    </ul>

    <ul>
      <li>
        <a href="https://example.com/dont-use-real-urls">Misery</a>
      </li>
      <li>
        <a href="https://example.com/especially-links-to-amazon-just-pick-a-real-bookstore">Carrie</a>
      </li>
    </ul>
  </body>

I understand that it's just an example but it's never just an example. Use appropriate landmarks or break your snippets down to the point where it's obvious that what you're pointing out isn't the whole thing. You don't need <body> or <ul> or <li>, just split the snippet in two, like this:

<a href="/my-favorite-books">My Favorite Books</a>
<a href="https://example.com/some-book">Every Man For Himself and God Against All</a>

Step 3: Introduce Javascript to restore the native functionality you broke in step one.

  <script>
    document.addEventListener("click", (event) => {
      if (event.target.classList.contains("native")) {
        event.preventDefault();
        window.location = event.target.href;
      }
    });
  </script>

Don't do that. I mean, don't really do any of this example, but really don't do this last part. Adding class="native" is as cumbersome as adding target="_blank", while also being more brittle. [I edited out a considerable amount of swearing here.] I think this is just a symptom of a bad example gone way too far.

If the client insists on opening all external links in new tabs, get it in writing and then do this:

<base target="_blank" />

let external_links = document.querySelectorAll('a[href^="http"]');
external_links.forEach((external_link) => {
  external_link.setAttribute('target', '_blank');
});

You can use querySelectorAll with a prefix attribute selector like 'a[href^="http"]' instead of a typical class selector. This lets you grab all the anchors with hrefs that start with "http" without adding extra syntax where it doesn't really belong. Once you've got your external links, iterate through that NodeList with forEach and tack on target="_blank" using setAttribute. That way, you're not re-implementing default behavior, you're only mildly annoying users with HCI devices, and if JS gets blocked all your links suddenly behave predictably.

Even this is bad! Just don't! It's so easy to not!


Other notes

  • You should probably start by explaining what an element is, then what an attribute is, then what a value is. Vocabulary is extremely important.
  • When referencing elements, include the chevrons in the inline style. <meta> vs meta. If they have to guess, they'll guess wrong. Suffix with "element" to really beat them over the head with it.
  • When referencing attributes, try to keep their values attached. class="foreign". If you can't, suffix it with "attribute."
  • When referencing values, keep those quotes! "false".
  • If it's a book about HTML, don't use JS. At all. Every time you reach for JS, stop. Like if you are about to write a self-invoking function to go and find invalid values of the rel attribute, for example, maybe don't.
schalkneethling OP ,

Thank you for the great feedback! This is one of the benefits of undertaking a project such as this in the open. I hear you with the <base> element. I was in two minds whether I should even include it. I am thinking now that I should, but introduce it merely for completeness and recommend not using it. I wonder if it will ever be deprecated.

Septimaeus , (edited ) in JavaScript Bloat in 2024

Edit: good luck :)

jaredwhite , in Announcing VitePress 1.0 | The Vue Point
@jaredwhite@lemmy.world avatar

Looks nice! I like that idea of a Markdown page being itself a Vue SFC. Pretty clever.

ThuleanPerspective , in Announcing VitePress 1.0 | The Vue Point

SNEED FEED SNEED'S CHUCK FOR FREE FLOYD HOT POCKETS CHUCK'S FLOYD CLEAN IT UP CITY SLICKER CHUCK'S CLEAN IT UP SUCK FEED JANNIES CITY SLICKER SEETHE CITY SLICKER CLEAN IT UP DILATE SEETHE DILATE SEETHE FUCK SNEED'S I CAN'T SUCK FLOYD FLOYD HOT POCKETS COPE SNEED'S FOR FREE CHUCK'S FLOYD COPE SUCK FUCK SNEED CITY SLICKER I CAN'T FLOYD SEED DILATE SUCK SUCK SNEED SNEED'S JANNY

https://lemmygrad.ml/pictrs/image/d0f23042-9f46-42fb-86bd-2a08538c6bc1.png
https://lemmygrad.ml/pictrs/image/d89a4c13-1e16-4021-a5af-08927279297b.png
https://czchan.org/uploads/1710961305917656.png
https://czchan.org/uploads/1710961306111010.gif
https://czchan.org/uploads/1710961307845375.png

  • All
  • Subscribed
  • Moderated
  • Favorites
  • random
  • webdev@programming.dev
  • test
  • worldmews
  • mews
  • All magazines