I suspect this might be possible with a little more knowledge of code, but I'm trying it relatively OoTB at the moment. If scripting is required, I'm more than willing to try it out but I'm somewhat new to Sharepoint and web development in general.

I have a page where I've added an anchor to a section via the HTML source editor.

Launching http://mysitecollection/subsite/sitepages/mypage.aspx#anchor1 from the nav bar or creating a normal hyperlink ON the page gets me to the correct section on that page.

However, if I try to add this same link in either the left-hand Quick Launch link menu or in the top navigation menu (edited via Site Settings > Navigation), it strips out my #anchor1 section of the link and simply ends up on the page.

(This part is required as I would like to have the page's subsections quickly available via the top navigation drop-down menu.)

I've searched through the posts already here about anchor tags, but the js provided within them seems to be working at the page level. My links seem to be having their #anchor1 stripped when I save the link.

What am I missing?

6 Answers 6


I ran into this same issue and switched over to using Managed Navigation. When you go to define your terms, on the Navigation tab, in the Navigation Node Type section, select Simple Link or Header and enter your link, anchor included. Works like a dream.


Actually - on a global navigation bar, it will strip out URL parameters such as ?Parm=abc etc... it seems to get upset at the question mark and deletes everything to the right of it - very annoying.


Unfortunately it does seem that SharePoint will strip out the anchor from a Url in the QuickLaunch or top nav. However, it won't strip out query strings, which you can use to your advantage, with a little bit of scripting.

I got the following to work in SP2013:

Added an anchor on a wiki page by editing the source and adding <a name="anchor1"></a>.

Then I created a link in the QuickLaunch with the following URL:


Then I added a Script Editor web part to the top of the page, and added this script snippet:

<script type="text/javascript">
function jumpToAnchor () {
    var anchorName = GetUrlKeyValue("anchor");
    if (anchorName) {
        var selector = "a[name='" + anchorName + "']";
        var anchor = document.querySelector(selector);

A couple things to keep in mind --

  • as Danny Engelman pointed out in the post he linked to in his comment, GetUrlKeyValue() is a handy built-in SharePoint javascript function you can use to get query parameter values.
  • the Element.scrollIntoView() method is supposedly "experimental", so YMMV. According to the MDN page linked to, however, its basic functionality is supported by most browsers.

I did have the same issue too since we have a custom home page and need to display the right content.

What I did was add ? in front of the # in the navigation and did the same thing in my custom home page.


The trick of adding a "?" no longer will work in future builds. They forced added a "/" at the end of the strings in newer releases.


Using /?#test works for me in hub top navigation


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.