this post was submitted on 14 Feb 2026
376 points (99.7% liked)

Programmer Humor

29741 readers
1855 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
[–] bleistift2@sopuli.xyz 2 points 16 hours ago (1 children)

If I understand correctly, you want to check the current domain (eg. w3schools) against api.w3schools and www.youtube, and return true for the first and false for the second (or the other way around)

Then technically it’s possible without string splitting:

const href = 'retrieved-from-the-anchor-element';
(new URL(href, location.href).hostname).endsWith(location.hostname)
[–] MonkderVierte@lemmy.zip 2 points 16 hours ago

Well, the whole web is basically "let's go, make it work somehow". Thanks for your effort!