- Community Home
- >
- Software
- >
- Software - General
- >
- A Practical Approach to SharePoint Customizations ...
Categories
Company
Local Language
Forums
Discussions
- Integrity Servers
- Server Clustering
- HPE NonStop Compute
- HPE Apollo Systems
- High Performance Computing
Knowledge Base
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Knowledge Base
Forums
Discussions
- Cloud Mentoring and Education
- Software - General
- HPE OneView
- HPE Ezmeral Software platform
- HPE OpsRamp Software
Knowledge Base
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-02-2026 12:02 PM
07-02-2026 12:02 PM
A Practical Approach to SharePoint Customizations After Custom Script Restrictions
Introduction
Microsoft's recent security updates in SharePoint Online have changed how custom scripts are handled, preventing inline JavaScript and CSS from executing through the Script Editor and Content Editor web parts in Classic and Modern pages. While these changes strengthen platform security, they also impact many existing SharePoint customizations. In multiple SharePoint projects, this challenge was addressed by implementing a practical workaround that externalized JavaScript and CSS files while preserving the required functionality.
Business Need
The SharePoint solution required was a custom client-side functionality to improve the user experience beyond the out-of-the-box capabilities. The requirements included:
- Implementing custom JavaScript for business logic and user interactions.
- Applying custom CSS to align the SharePoint pages with the organization's branding.
- Keeping the solution lightweight without introducing unnecessary complexity.
- Making future maintenance and enhancements simple for the development team.
Ideally, these requirements could be achieved by adding JavaScript and CSS directly into the Script Editor or Content Editor web part. However, Microsoft's recent security updates changed this behaviour.
Challenges in the Existing Process Before Restriction
After Microsoft's security enhancements, several issues were observed during implementation:
- The Script Editor web part no longer executed inline JavaScript.
- JavaScript entered directly into the editor was ignored.
- Inline CSS and styling were restricted, preventing page customization.
- Existing customizations became difficult to maintain using the previous approach.
- Rebuilding the entire solution using SPFx was not feasible for the project's timeline and scope.
These limitations required an alternative solution that could preserve the required functionality while working within SharePoint's current security model.
Solution Implemented
To overcome these restrictions, the custom code was separated from the SharePoint page instead of embedding it directly in the web part.
The implementation consisted of the following steps:
- Created a dedicated JavaScript file containing all business logic as per the context.
- Created a separate CSS file containing all custom styles also as per the requirement.
- Uploaded both files to the SharePoint Site Assets library or create a document library inside Site Assets as per the project name and upload there.
- Referenced these external files from the SharePoint page instead of writing JavaScript and CSS directly inside the Script Editor web part as shown below:
- Organized the code into reusable modules so that multiple pages could use the same resources.
This approach kept the SharePoint pages clean while allowing the custom functionality and styling to load from centrally managed files.
Key Benefits
After implementing this solution, few advantages seen are as follows.
Centralized Maintenance - All JavaScript and CSS are maintained in dedicated files, making updates much easier.
Reusability - The same files can be reused across multiple SharePoint pages without duplicating code.
Cleaner Page Design - SharePoint pages contain minimal embedded code, making them easier to manage.
Faster Enhancements - Future changes require updating only the external JavaScript or CSS file rather than modifying every page individually.
Better Code Organization - Separating business logic and styling follows standard web development practices and improves readability.
This approach enabled team to continue delivering the required SharePoint customizations despite the platform's security restrictions, without requiring a complete redesign of the existing solution.
Wrap Up
Certainly, Microsoft's restrictions on custom scripts gives us more secure development practices, they can create challenges for projects that rely on lightweight client-side customizations. By moving JavaScript and CSS into external files and referencing them from SharePoint, it was easier to successfully maintain the required functionality in the project without a complete redesign. If you are facing similar limitations, this approach can serve as a practical and maintainable solution until a full migration to SharePoint Framework (SPFx) is required.
I work at HPE
HPE Support Center offers support for your HPE services and products when and how you need it. Get started with HPE Support Center today.
[Any personal opinions expressed are mine, and not official statements on behalf of Hewlett Packard Enterprise]