function isLocalUrl(url) { const currentHostname = window.location.hostname; const urlHostname = new URL(url).hostname; // Compare the hostnames to determine if the URL is local return currentHostname === urlHostname; }