Forum Discussion

adamceros's avatar
adamceros
Copper Contributor
Nov 14, 2023

Modern Script Editor web part modifying script tags in SPO Modern with "pnp" as type causing failure

Using the Modern Script Editor web part in an instance of SharePoint Modern Online, when adding third-party embed codes that contain script tags, the type value of script tag is being modified to "pnp" and an additional data attribute of pnpname is being added with a string of letters, numbers and hyphens as the value.

 

For example, if this script tag is added within the web part:

<script type="text/javascript" src="https://domain-of-file/jsfile.js" data-attribute="value"></script>

It is being changed to this:

<script type="pnp" src="https://domain-of-file/jsfile.js" data-attribute="value" pnpname="e979e7cc-671e-4406-b64b-a815dcc44037"></script>

 

This change is resulting in the following error in the browser console:

Failed to load resource: domain-of-file/jsfil...pnp=1699299773589:1 net::ERR_FAILED

 

This is of course preventing necessary JavaScript from running and causing issues with the third-party element we're trying to embed.

 

This is the web part we're using: https://github.com/pnp/sp-dev-fx-webparts/tree/main/samples/react-script-editor

 

It was downloaded already compiled from here: https://sharepointshepherd.com/product/pzl-script-editor/

 

We have been through all the settings in SharePoint we can think of, and have not been able to figure this out.

 

Any help or suggestions would be appreciated!

No RepliesBe the first to reply