question

ShivakrishnaPathem avatar image
0 Votes"
ShivakrishnaPathem asked Jerryzy commented

How to inject Javascript file in to sharepoint master page without modifying it

Hello Team,

I am trying to inject java script file into sharepoint master page without modifying/opening the master page. tried many solutions but not working.

Tried 'Add-PnPJavaScriptLink' and 'Add-PnPJavaScriptblock' this two as well but not luck.

Requesting your assistance on the same.

Thanks & Regards,
Shiva Krishna

office-sharepoint-online
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @ShivaPathem-4926 ,

Is there any update ? If the answer is helpful to the question, I suggest you could accept as answer so that it could also help others who have the smiliar question in the forum :)

Thanks
Best Regards

0 Votes 0 ·

1 Answer

Jerryzy avatar image
0 Votes"
Jerryzy answered

Hi @ShivaPathem-4926 ,

"Add-PnPJavaScriptLink" and "Add-PnPJavaScriptblokc" are only valid for class site experience.

If it's the Modern site, then it's suggested to use SPFX Application Customizer Extension for injecting, here is a step by step demo for your reference:

Step By Step Procedure To Add A JS File To All Pages In A SPFx Modern Pages Using SharePoint Framework Extension

Thanks
Best Regards



If the response is helpful, please click "Accept Answer" and upvote it.

Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.



5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.