Im running SharePoint 2013 with SP1. I need to add a hashtash to the url. As seen below. Everytime I add the hashtag and then Save the navigation settings, the hashtag gets removed.
Is this a bug and does anyone else have this issue?
Thanks.
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It only takes a minute to sign up.
Sign up to join this communityIm running SharePoint 2013 with SP1. I need to add a hashtash to the url. As seen below. Everytime I add the hashtag and then Save the navigation settings, the hashtag gets removed.
Is this a bug and does anyone else have this issue?
Thanks.
This is done purposly. SharePoint uses the hash for MDS (Minimal Download Strategy), and also # is a reserved character in URL:s (used for hash-based navigation)
Just to share some code, this is how I got around the issue and it works perfectly. The code below would go inside a $(document).ready() function
//About the following block of code
//Because of SharePoint MDS, SP doesnt like appending data to the querystring of a navigation item.
//If a navigation item has data appeneded like a ? or #, it gets stripped off. I have contacted MS about this and this is by design
//To get around this, I have that when a navigation item label startes with #, then the #gets stripped off and the url gets
//appended a # along with the label with spaces stripped off, so the anchor tag will work. -- TJF
$anchorResults = $('a').filter(function() {
var txt = $(this).text();
return (txt.length > 1 && txt[0] == '#');
});
$.each($anchorResults, function (index, value) {
var txt = $(value).text().substring(1);
var href = $(value).attr('href') + '#' + txt.replace(/ /g, '');
$(value).text( txt );
$(value).attr('href', href);
});
//End Block
For people who are trying to use a hash within their URL parameter. One possible thing you can try is creating a custom sharepoint redirect page, that has a navigation term (friendly URL), that then redirects to your desired hash URL location. Works for me.