Closed Gennady-G closed 2 years ago
Hi @Gennady-G !
Just create javascript file and drop it to a folder in SP. Then inject that file using SP Editor's ScriptLinks functionality. Now, if you have installed the Modern ScriptLink App, the file you injected will be loaded when opening page in the injected files scope.
The source code of Modern ScriptLinks App can be found here https://github.com/tavikukko/sp-scriptlinks
I hope this helps, Tomi
The source code of Modern ScriptLinks App can be found here https://github.com/tavikukko/sp-scriptlinks
So as I've understand - it is something like 'Dynamic Application Customizer', that can append different js files to page header
But what should be inside js file?
I tried to add App to site-collection, uploaded file with "console.log('Hi!')" but don't see if it is loaded..
Or I do something wrong..
My url is: https://server.sharepoint.com/sites/dev/SiteAssets/scriptlink.js
App is deployed successfully:
Ok, I need to check if that App still works as it should. But it just loads that file what you have injected and execute it, that's all. So the console.log just print something.
Ah, ok! so I don't see it in Network tab.. But it prints nothing in console, too..
Change the scope to sitecollection in the ScriptLink.
Seems like the App only reads sitecollection links. But anyways, I don't think people should use sub webs with Modern SharePoint.
Wow! Thank You much @tavikukko , as usual! :) Now it works perfect!)
Hi @tavikukko !
Occasionally noticed that Edge version has "Modern Scriptlink App", that installs *.sppkg in App Catalog.
How can I use it? What code should be in js file?
For example earlier CSR was registered like this (this is example of code generated by Cisar, https://github.com/andrei-markeev/cisar):
What type of js can we use in Modern Scriptlink? Maybe You have some example?
Best regards, Gennady