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:
If you look at the documentation you can take just the properties you're interested in from the window object i.e.
window
protocol + '//' + hostname + pathname