First let me apologize, I am not a developer and this is my first attempt using VS to try and do something. Really wish I could just set this in PowerShell and be done with it.
I have a simple script file that sets the Status Message bar
<script type="text/javascript">
ExecuteOrDelayUntilScriptLoaded(BroadcastMessage, "sp.js");
function BroadcastMessage()
{
var statusID = SP.UI.Status.addStatus("Important","SharePoint message blah blah , read <a href='/SiteAssets/BroadcastMessage.pdf'>Document Link </a> for more information.");
SP.UI.Status.setStatusPriColor(statusID, 'blue');
}</script>Works great as code snippet, but I need this deployed to all my SharePoint pages (900+ site collections). I have been reading tutorials on how to insert code via AdditionalPageHead, and don't want to modify the MasterPage.
In VS, I create a project, it checks out no errors, but when I hit F5 to test the web page comes up with no status message (and the first tutorial that's supposed to send a popup box with hello world, couldn't even get that to work.)
Tried this one and replaced the ref for jQuery with my script instead (hosted in /SiteAssets/), didn't work https://blogs.msdn.microsoft.com/kaevans/2011/04/06/adding-jquery-to-every-page-in-sharepoint-with-delegate-controls/
Can someone help me, I can usually figure stuff given enough time. I've been at this two days and really need it to go into prod soon. And if the above script could be written better, would appreciate that as well.
Thanks
James
Note: SharePoint 2013 and using Visual Studio 2019 Community Edition