Change this...
www.sample.com/sample.html#commentxxx?stuffhereIdontneed
into this...
www.sample.com/sample.html
I have it in a link so I think I need a regex?
document.write("<a href='"+ window.location.href.replace('?????', '') +
"?ThisIsAppendedLater'>sample</a>");
Nathan's answer is good. For completeness' sake; here's the regex:
var stripped = window.location.href.replace(/#.*$/,'');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With