We've added a custom JavaScript to SharePoint 2019 on all modern pages (it's just a standard script tag, <script src="..." type="module">). It works fine except when SharePoint do a partial page load, then the script won't execute. I don't understand why or when SharePoint decide to do a full- or a partial page load, some links do, some don't. But it happens when I go from one library to another using the left navigation links (Quickstart).

Is it possible to execute my script even when the page is not fully loaded? I've experimented a bit using observers, because the changes when I go to another page obviously, and so I thought i could hooked up on that one. But with no luck.

  • You can try these 2 things: (1) Check this solution for properly loading your custom JS on site page: sharepoint.stackexchange.com/questions/251853/…. (2) Try deactivating Minimal Download Strategy feature from site settings. Let me know if it works for you. Mar 22 at 5:36
  • @GaneshSanap-MVP Thanks, but I’ve already tried that. The script has already fired, and the partial load won’t trigger it again. MDS makes no difference whether it’s activated or not.
    – steedwmax
    Mar 22 at 11:28


Your Answer

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