Add script to sharepoint page

%3CLINGO-SUB%20id%3D%22lingo-sub-2878374%22%20slang%3D%22en-US%22%3EAdd%20script%20to%20sharepoint%20page%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2878374%22%20slang%3D%22en-US%22%3E%3CP%3EI've%20tried%20adding%20a%20script%20using%20%22Code%20snippet%22%20element%20but%20it%20doesn't%20show.%20I've%20read%20that%20SharePoint%20only%20accepts%20iframes%2C%20no%20scripts%20for%20security%20reasons.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EJust%20wondering%20if%20there's%20any%20way%20I%20can%20edit%20the%20Page%20Source%20to%20add%20this%20code%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI've%20watched%20old%20tutorials%20on%20YouTube%20and%20it%20seems%20that%20before%20you%20could%20do%20that.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%2C%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2878374%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3ESharePoint%20Online%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ESites%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2878400%22%20slang%3D%22en-US%22%3ERe%3A%20Add%20script%20to%20sharepoint%20page%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2878400%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1194356%22%20target%3D%22_blank%22%3E%40BeaUserWay%3C%2FA%3E%26nbsp%3Bin%20earlier%20on-premise%20versions%20of%20SharePoint%20there%20was%20the%20script%20editor.%20That%20is%20not%20available%20in%20SharePoint%20Online%20out-of-the-box%20it's%20on%20a%20modern%20page%20not%20possible%20to%20add%20scripts.%20On%20a%20classic%20page%20it's%20still%20possible%20to%20use%20the%20script%20editor%20but%20the%20settings%20have%20to%20be%20switch%20on%20by%20your%20tenant%20admin%20(though%20most%20IT%20departments%20won't%20allow%20it%20in%20my%20experience).%20Info%20on%20this%20is%20%3CA%20href%3D%22https%3A%2F%2Fwww.spguides.com%2Fenable-script-editor-web-part-in-sharepoint-online%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3Ehere%3C%2FA%3E.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ERob%3CBR%20%2F%3ELos%20Gallardos%3CBR%20%2F%3E%3CFONT%20size%3D%222%22%20color%3D%22%23006400%22%3EIntranet%2C%20SharePoint%20and%20Power%20Platform%20Manager%20(and%20classic%201967%20Morris%20Traveller%20driver)%3C%2FFONT%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
Occasional Visitor

I've tried adding a script using "Code snippet" element but it doesn't show. I've read that SharePoint only accepts iframes, no scripts for security reasons.

 

Just wondering if there's any way I can edit the Page Source to add this code?

 

I've watched old tutorials on YouTube and it seems that before you could do that.

 

Thanks, 

1 Reply

@BeaUserWay in earlier on-premise versions of SharePoint there was the script editor. That is not available in SharePoint Online out-of-the-box it's on a modern page not possible to add scripts. On a classic page it's still possible to use the script editor but the settings have to be switch on by your tenant admin (though most IT departments won't allow it in my experience). Info on this is here.

 

Rob
Los Gallardos
Intranet, SharePoint and Power Platform Manager (and classic 1967 Morris Traveller driver)