encodeuri hashtag code example Example: encodeuri hashtag url = encodeURI(url); url = url.replace(/#/g, '%23'); //you'll have to replace hash