0

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.

steedwmax
  • 47
  • 6
  • You can try these 2 things: (1) Check this solution for properly loading your custom JS on site page: https://sharepoint.stackexchange.com/questions/251853/run-javascript-after-page-loads/251854#251854. (2) Try deactivating Minimal Download Strategy feature from site settings. Let me know if it works for you. – Ganesh Sanap - MVP Mar 22 '24 at 05: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 '24 at 11:28

0 Answers0