Please find below code…
//Get current page url
var curr_url = window.location.href
//Get hostname
var host_name = window.location.hostname
//Display the path name of the current URL
var path_name = window.location.pathname
//Get protocol of URL return http:// or https://
var proto = window.location.protocol;
//Get parameters from URL
var x = location.search;
Result:
?email=someone@example.com