If I use:
alert(window.location.href);
I get everything including query strings. Is there a way to just get the main url part, for example:
Just one more alternative using URL
var theUrl = new URL(window.location.href); theUrl.search = ""; //Remove any params theUrl //as URL object theUrl.href //as a string