Hello all, This is my first post in this forum, and I only know a limited amount of JavaScript. My question is this: I'm getting the page URL by using: document.location.href Sometimes, the URL is going to be displayed as: www.example.com/page.html#section1 How can I remove everything after the ".html" in my variable? Is there an easy way to do this in JavaScript? If this were PHP, it would be easier for me. Thanks, Peter EDIT: After messing around with the code a bit, I figured it out. document.location.href.replace(/.html.*/,\".html\") Code (JavaScript):