This JavaScript function will return the URL name along with the protocol ('http' or 'https') value.
function GetHost() {
if (typeof
location.protocol == 'undefined') {
alert('location.protocol is undefined');
}
if (typeof
location.host == 'undefined') {
alert('location.protocol is undefined');
}
let host =
location.protocol + '//' + location.host + '/';
return host;
}
No comments:
Post a Comment