Display SharePoint List Data using Modern Script Editor

Copper Contributor

Hello All,

 

Can we get the Online SharePoint List  Items and display in Modern Script Editor using Rest or JSOM.

Because I am unable to run even a small below alert java script

 

<!DOCTYPE html>
<html>
<body>

<p>Click the button to display an alert box.</p>

<button onclick="myFunction()">Try it</button>

<script>
function myFunction() {
alert("Hello! I am an alert box!");
}
</script>

</body>
</html>

1 Reply

@siddiq ali If I understand your question, you are asking about the availability of the Script Editor Web Part (SEWP) or Content Editor Web Part (CEWP) in SharePoint Online. Both of these web parts allows content editors to inject javascript on the page.  Microsoft intentionally has not ported either of those web parts into SharePoint Online with the reason being the multitude of issues this type of code can cause, including security issues. To my knowledge, they have not plan to change thier position.

The approved solution is to create a SharePoint Framework (SPFx) webpart to run the code. While there is a learning curce to SPFx, the result is code that is safer and ensures admin oversight (capability.) IF you have code that is already running in a SEWP, putting that into SPFx should not be too difficult.

 

I hope this answers your question. If so, please mark my response as the approved answer. Thanks.