2 lines
518 B
JavaScript
2 lines
518 B
JavaScript
function o(t,n){if(!t||typeof t!="string"){console.warn("navigateToPage: Invalid URL provided");return}if(t.startsWith("http://")||t.startsWith("https://")||t.startsWith("//")){window.open(t,"_blank");return}if(t.startsWith("#")){const e=document.getElementById(t.slice(1));e&&e.scrollIntoView({behavior:"smooth"});return}if(typeof window<"u"&&window.swup)try{n?.replace||window.swup.navigate(t)}catch(e){console.error("Swup navigation failed:",e),i(t)}else i(t)}function i(t,n){window.location.href=t}export{o as n};
|