Skip to content

Instantly share code, notes, and snippets.

@parhumm
Last active July 9, 2021 21:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save parhumm/9f096a889fb27bbb35d1e149f6d5a1ec to your computer and use it in GitHub Desktop.
Save parhumm/9f096a889fb27bbb35d1e149f6d5a1ec to your computer and use it in GitHub Desktop.
function() {
var virtualPagePath = '';
try {
// Add subdomain before page path
var locationSplitDot = window.location.host.split('.');
if (locationSplitDot && locationSplitDot[1]) {
if (locationSplitDot[0] !== 'www') {
virtualPagePath = location.host;
}
}
} catch(e) {
console.error(e)
}
// Add current page path
virtualPagePath += location.pathname;
return virtualPagePath;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment