you are viewing a single comment's thread
view the rest of the comments
[–] 4 points 8 months ago* (last edited 8 months ago) (3 children)

A userscript over links for debugging purposes, that should ignore links to the same domain (www.w3schools vs campus.w3schools vs www.youtube).

Btw, it's funny how support.mozilla and some standards-teaching-sites are some of the worst offenders of web standards.

Edit: how to stop this auto-linking?

  • source
  • parent
  • hideshow 3 child comments
  • [–] 2 points 8 months ago (2 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)
    
  • source
  • parent
  • hideshow 2 child comments