Embed code in a SharePoint 2013 web part page

The estimated reading time for this post is 0 minutes

A quick post here to share a new feature in SharePoint 2013 that enables you to easily embed code such as javascript and CSS into the content area of a web part page for example.

Insert action to embed code
Insert action to embed code

Previously we did this by editing the page source or by creating lots of text files and linked them using the “Content Link” parameter in “Content Editor Web Parts (CEWP’s)”. Now we can easily embed code on a content page where SharePoint places it is in a lovely dedicated snippet section that is only visible when you edit the page.

Code embed in page content
Code embed in page content
Embed code window
Embed code window

When you add any javascript SharePoint converts the “edit snippet” link as shown above to a web part where you then edit the content much like the “Content Editor Web Part”.


Posted

in

,

by

Tags:

Comments

One response to “Embed code in a SharePoint 2013 web part page”

  1. Alasdair avatar
    Alasdair

    Sometimes this doesn’t work. In my experience you enter the tag into the box, click Insert and it doesn’t work. When you go back to edit the embed code it’s just blank.

    I’ve found a way to fix this. Rather than repost the same fix all over the internet, I’ve replied to a query on Stack Overflow here:

    http://stackoverflow.com/questions/21905139/sharepoint-2013-deleteing-contents-of-style-in-embed-code-when-saving

Leave a Reply