I'm using the Modern Script Editor Webpart from pnp/sp-dev-fx-webparts GitHub. Installation and deployment all went fine and I can also execute JavaScript code on my sample modern teamsite.
Here's an example:
<script type="text/javascript"> let elem = document.querySelectorAll("[class='CanvasComponentWrapper']"); elem[0].style.maxWidth = '90%'; </script> This code widens the canvas and it works as intended. However when I leave the homepage, going into Documents for exmaple, and navigate back to Home the script is not applied any longer. On the other hand, if I click on Home once more in the Quick Launch nav it will reload the script.
So the behavior is: After leaving and returning to the page hosting the webpart/script the script is not reapplied unless the page was reloaded twice.
Any idea why that could be?
Thanks.
However, I noticed that
