Skip to content Skip to sidebar Skip to footer

Javascript Substring Method Assistance

So long story short im working on a web app and using AJAX within it. I'm trying to disable the default actions of links when clicked, attach a hash value to the link and then remo

Solution 1:

Well, you don't really change the link itself, you only change the window.location.hash, and the hash always has a "#" at the beginning.

What you need to do in order to change the entire url (and remove the '#') is to manipulate the browser history.

Although you should know it works only in newer browsers (the exact browser versions are in the link), so if you target your website to older too browsers you might need to think about having a fallback using the hash. If you decide to have such a fallback, I suggest searching for a plugin which does it instead of making it all yourself.

Post a Comment for "Javascript Substring Method Assistance"