Fix SharePoint Scriptable Web Part Errors on Modern Pages
Question details
The user needs a supported way to customize a SharePoint page when script and style tags cannot be used to hide column headers.

- Product
- Microsoft SharePoint
- Device & OS
- not provided
- Scenario
- The user wants to customize the appearance of columns on a modern SharePoint page, potentially using custom code or an iframe.
- Observed behavior
- Modern pages strip or do not support script and style tags in this context, and enabling custom scripting does not make those tags work on the page.
Confirm whether you are editing a modern SharePoint page or a classic site page, and identify the list or content whose appearance you want to change. If you plan to embed a page, have its browser-accessible URL ready and check your organization's embedding restrictions.
Use a supported list view and web part on a modern page
Use this approach to control which list columns appear without inserting script or style tags.
A list view can hide individual columns, but it does not necessarily hide the remaining column headers. Custom script and style tags are not a supported way to hide those headers on a modern page.
Open the SharePoint list, select the view menu, and choose Edit current view. Clear the columns you do not want to display, then save the view.
Open the page and select Edit. Add a List web part using the plus button, or select an existing List web part.
Open the List web part's edit panel, choose the list and the configured view, then select Republish or Publish.

Embed a browser-renderable page with a valid iframe URL
Use an Embed web part if the desired content is hosted on a page that permits embedding.
Use a classic SharePoint page when custom code is required
Consider a classic site page if the requirement cannot be met with supported modern components and your organization permits custom scripting.
Work with Office documents using WPS Office
WPS Office is a free, lightweight alternative for working with documents, spreadsheets, and presentations. Its familiar interface and Microsoft Office format compatibility make it easy to move existing files into your workflow. It does not fix SharePoint page scripting restrictions.

Frequently Asked Questions
Why does enabling custom scripting not fix my modern SharePoint page?
Modern pages do not support inserted script and style tags in the same way as classic pages. Use supported web parts or consider an approved classic page if custom code is essential.
Can I hide list columns without using CSS?
Yes. Open the list's view menu, select Edit current view, and clear the columns you do not want to show. This hides those columns rather than just their headers.
What does an iframe need to work in SharePoint?
An iframe needs a src attribute pointing to a browser-renderable page. The source site must allow embedding, and the domain must satisfy SharePoint's embedding restrictions.
Can I add JavaScript to a modern page with the Embed web part?
The Embed web part is for supported embedded content, not for running arbitrary JavaScript or CSS on the modern page. Use a supported SharePoint component or consult your administrator about approved customization options.




