Caroline Sosebee is a Software Engineer at ThreeWill. She comes to us with 20+ years of software development experience and a broad scope of general IT support skills.
It Started as a Normal Migration
The Problem – Not Displaying “Apps you can add” Section
Now here we are over a year later and we had a need to make an update to the master page on one of the sites for the first time since the migration. The fix we needed to apply had to do with the ‘Add an App’ page and its ability to show the ‘Apps you can add’ section correctly.
This site is outward-facing and highly customized, so we had hidden many of the OOTB SharePoint navigation and other links from the users when first implementing it. In doing this though, the ‘Apps you can add’ section also ended up hidden. In order to correct this problem, we needed to insert a single line of HTML into the master page to make it visible again. I found this article by Elio Struyf to be extremely helpful in resolving this issue, with its clear explanation and solution. Thanks, Elio!
For the curious, here is the line we needed to add and it did indeed solve our problem.
<span id="ms-pageTitleCurrentNode" style="display:none;"></span>
The ‘Apps you can add’ zone requires this for some reason and it doesn’t really matter where on the page it is, as long as it’s there. You can read Elio’s post about it for more details.
Ripple Effect – Custom Script Files Were no Longer Loading
Which leads me to the real problem I decided needed a call out. After applying this update to the master page, we suddenly started seeing jQuery errors on certain pages and some of our custom code was no longer running. Huh? It was working just fine before this other change. How would inserting a cause a jQuery error?
The only other change that had been made was the installation of some third-party software for a project we were working on. So, of course, our first thought was that there might be a jQuery conflict somewhere. This took us down many rabbit holes in the pursuit of a solution but was ultimately not the problem.
After much angst, I finally tracked down a solution to the problem. In the body of our master page, we were loading our scripts using regular script tags, like so:
The Solution to Scripts Not Loading From Master Page
These script tags were being completely ignored. It wasn’t until I changed them to be SharePoint:ScriptLink calls, that they finally started loading correctly.
Ok, yes this is a best practice for loading scripts from a master page and it’s good to have these now loading the ‘correct’ way. But why did they work with script tags before and not after a simple change to something unrelated? I certainly do not know myself. I read a lot of articles while trying to resolve this but never found a clear explanation. The closest I got was one article that said <script> tags are not supported by MDS (Minimal Download Strategy). But we have MDS turned off for this site, so that’s not it.
Here I slide into mere speculation as I’m truly clueless. My best guess is that something in SharePoint 2016 (and on up) is now requiring ScriptLink tags instead of plain <script> tags. Once we touched the page for the first time since migration, this check was triggered. Which of course makes zero sense but is the only thing I can come up with. It had been working fine for a year with the <script> tags, until the day we touched the page.
Does anyone out there have a true explanation? Feel free to share it in the comments! I would love to know.