On my SP site, I'm sending some queries with URL to filter data,


Few months back it was working fine, but now url generating Slash (/) between ?queryTags# and tags,


now filter data function is not working because of that extra /. How can I remove that slash from URL,

I can't make changes in filter date function because it's containing tons of code.

2 Answers 2


Replace string with javascript with replace function

 url.replace("#/", "#")
  • Can you please elaborate more? Commented Feb 7, 2017 at 12:42
  • 1
    But if you use JavaScript for replace then above code will replace only for first occurrence in string. So if "#/" is multiple time then it will not work. Commented Feb 7, 2017 at 13:41
  • I'm sending replace queries in filter function and this trick worked for me. Commented Feb 8, 2017 at 5:51

You can try following code to solve your problem:

var _pageUrl=document.URL;//page URL

var _queryTags = JSRequest.QueryString["queryTags"]; //QueryString

_queryTags = replaceAll(_queryTags,"//",""); //Replacing '/' with empty space

//reusable function for replace all
function replaceAll(str, find, replace) {
  return str.replace(new RegExp(find, 'g'), replace);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.