
Check If an URL is Internal or External in JavaScript/TypeScript
Knowing whether a link is internal or external is essential for setting rel in HTML a tag. For an external link, noreferrer noopener nofollow is usually recommended. To test a full URL or relative path in JavaScript/TypeScript, we'll be using URL constructor. It's available in both browsers and Node.js.