I have a current URL:
http://www.test.com/p1234?utm_source=....
How do I get a URL with the format http://www.test.php/p1234
I am using javascript document.URL
, the result is http://www.test.com/p1234?utm_source=....
I have a current URL:
http://www.test.com/p1234?utm_source=....
How do I get a URL with the format http://www.test.php/p1234
I am using javascript document.URL
, the result is http://www.test.com/p1234?utm_source=....
This is the correct answer:
window.location.host + window.location.pathname;
You want this:
var location = window.location.host + window.location.pathname;
see the docs: https://developer.mozilla.org/en-US/docs/Web/API/Location