SharePoint likes to keep code safe and when adding embedded code SharePoint takes a look and decides whether or not to it likes it. And a good example of this is YouTube content.
SharePoint being safe
When we navigate to our SharePoint we select the Edit site button and then click on HTML and select Edit HTML Source.
I’ve selected a video from YouTube and have copied the embedded code. I’m now going to paste this code into the window that opened up.
When we select OK to save this code and expect the YouTube video to load on our page we get this yellow warning message appear and then disappear very quickly and the YouTube video appears on our page.
When we click save to save the page the YouTube video disappears and when we go and check the HTML Source it is now completely empty.
Embedding code to SharePoint
There are many ways to resolve this issue and one of these includes stopping SharePoint from removing the embedded code but this isn’t realistic.
Instead we are going to save the content of the embedded code to a text file, upload it and then use a web part to pull this information viewing it as HTML and loading the content.
Open notepad and paste the embedded code into it.
Save the file and upload the file into SharePoint. A good place would be the SiteAssets library.
Add a content editor web part to your page and edit the web part.
In the properties box down the right hand side you will see 3 dots, click on these to open up a new windows.
Paste the URL of the text file we uploaded and click OK
When you now save your SharePoint page you will always have your embedded code.
This doesn’t necessarily have to be a YouTube video. It could be flash code, html code or any other embeddable code.