hashtag encodeuri

url = encodeURI(url);
url = url.replace(/#/g, '%23'); //you'll have to replace hash
Friendly Hawk