How to Host a Custom JavaScript or Vue.js App in SharePoint Online
Question details
The user wants to upload and run a custom JavaScript application (such as Vue.js or React) directly within a SharePoint Online document library.

- Product
- SharePoint Online
- Device & OS
- not provided
- Scenario
- Uploading a custom ASPX or JavaScript file to a document library in hopes of rendering a standalone frontend application.
- Observed behavior
- SharePoint forces the ASPX or JS file to download to the user's local machine instead of executing and rendering the application in the browser.
Verify whether you have Global Administrator or SharePoint Administrator privileges, as standard users cannot modify the strict custom script security settings in SharePoint Online.
Package the Application as a SharePoint Framework (SPFx) Web Part
This is the safest and only officially supported method by Microsoft for running modern JavaScript frameworks (like Vue.js, React, or Angular) in SharePoint Online.
SharePoint Online modern pages are not designed to run raw ASPX or JS files from document libraries due to strict security architectures. Converting your application into an SPFx web part ensures it runs natively within the SharePoint context while adhering to tenant security policies.
Install Node.js, Yeoman, Gulp, and the Yeoman SharePoint generator (@microsoft/sharepoint) on your local machine.
Open your command line interface, run 'yo @microsoft/sharepoint', and follow the prompts to create a new Client-side web part.
Move your Vue.js or React components into the newly created SPFx project structure, ensuring the entry points match the web part's render method.
Run 'gulp bundle --ship' and 'gulp package-solution --ship' to generate an .sppkg file. Upload this package to your SharePoint Tenant App Catalog to make it available across your sites.

Enable Custom Scripts via SharePoint Admin Center
If you absolutely must run legacy ASPX files or inject standalone JavaScript, a tenant administrator can lift the custom script restrictions.
Host Externally and Display via Embed Web Part
Bypass SharePoint's script restrictions entirely by hosting your Vue.js or React app on a dedicated web server and embedding it into SharePoint.
Looking for a Simpler Way to Manage Documents? Try WPS Office
While managing SharePoint administrative policies and custom app deployments can be highly complex and developer-intensive, daily document management doesn't have to be. WPS Office provides a lightweight, highly compatible, and user-friendly environment for your standard document, spreadsheet, and presentation needs without requiring complex IT configurations.

Frequently Asked Questions
Why does my ASPX file download instead of opening in SharePoint?
SharePoint Online blocks custom scripts by default to prevent malicious code injection. When a document library encounters an ASPX or JS file containing scripts without admin approval, the server forces it to download as an attachment rather than rendering it in the browser.
Can I use Vue.js or React directly in a classic Content Editor Web Part?
While it was historically possible in classic SharePoint Server environments, modern SharePoint Online pages do not support the Content Editor Web Part. The officially supported route for modern sites is migrating your code into a SharePoint Framework (SPFx) web part.
How long does it take for custom script settings to take effect in SharePoint Online?
If a Global or SharePoint Administrator enables custom scripts via the SharePoint Admin Center GUI, it typically takes about 24 hours for the changes to apply across the entire tenant.
Where can I get developer help for SharePoint Framework (SPFx)?
Because custom JavaScript and SPFx development falls outside general user support, the best places to seek developer assistance are the official Microsoft Learn documentation, the Microsoft Tech Community, or SharePoint Stack Exchange.




