Forum Discussion
Thomsch
Aug 25, 2022Iron Contributor
HTML code embed into SharePoint Online page
A colleague of mine is using a HTML code on the current SharePoint on-prem 2013 environment to place svg graphics onto another SVG image.
Is it still possible to embed an HTML code into a SharePoint Online page?
<!DOCTYPE html>
<html>
<body>
<!-- insert width/height in line below to define picture size, makes sense to align with size of background image -->
<svg id="screenshot1" width="500" height="400" xmlns="http://www.w3.org/2000/svg">
<!-- define path to background image below -->
<image href="base-image.svg"/>
<!--predefined marker symbols -->
<symbol id="arrow-red-solid"><image href="./arrow_red_solid.svg"/></symbol>
<symbol id="arrow-red-outline"><image href="./arrow_red_outline.svg"/></symbol>
<symbol id="arrow-orange-solid"><image href="./arrow_orange_solid.svg"/></symbol>
<symbol id="arrow-orange-outline"><image href="./arrow_orange_outline.svg"/></symbol>
<symbol id="arrow-blue-solid"><image href="./arrow_blue_solid.svg"/></symbol>
<symbol id="arrow-blue-outline"><image href="./arrow_blue_outline.svg"/></symbol>
<!-- use picture markers, shapes, text as needed, follow SVG syntax https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial -->
<!-- shape positions are expressed in pixel where the origin is the top left corner of the image, x=left-right, y=top-bottom -->
<line x1="10" x2="50" y1="110" y2="150" stroke="black" stroke-width="5"/>
<rect x="360" y="230" width="100" height="20" style="fill:none;stroke:blue;stroke-width:2" />
<rect x="320" y="300" rx="5" ry="5" width="100" height="20" style="fill:none;stroke:orange;stroke-width:2"/>
<circle cx="50" cy="50" r="10" style="fill:none;stroke:red;stroke-width:2"/>
<ellipse cx="150" cy="50" rx="30" ry="10" style="fill:none;stroke:red;stroke-width:2"/>
<use x="80" y="180" href="#arrow-red-solid" />
<use x="60" y="250" href="#arrow-red-outline" />
<use x="100" y="200" href="#arrow-blue-outline" />
<use x="120" y="220" href="#arrow-orange-outline" />
<text x="380" y="220" font-size="24" fill="blue">Text1</text>
</svg>
</body>
</html>
Right now I'm not able to do that with the "embed" webpart.
Thanks
Hi Thomsch
Another possible solution is to have your HTML code on external URL and use it as an iframe inside out of box Embed web part.
For more info, please see: https://support.microsoft.com/en-us/office/add-content-to-your-page-using-the-embed-web-part-721f3b2f-437f-45ef-ac4e-df29dba74de8
- NanddeepNachanLearn Expert
Hi Thomsch
Another possible solution is to have your HTML code on external URL and use it as an iframe inside out of box Embed web part.
For more info, please see: https://support.microsoft.com/en-us/office/add-content-to-your-page-using-the-embed-web-part-721f3b2f-437f-45ef-ac4e-df29dba74de8
- ThomschIron ContributorThanks guys for your help. I've used the HTML code via an external URL.
- dcancelosCopper Contributor
Hey Thomsch,
You could try to use the "Modern Script Editor" webpart made by the author: Mikael Svenson.
I use it for a couple of things using HTML and it works perfectly.
Let me know if it helped you!
- ThomschIron ContributorGreat! How can I add such a non-official webpart into SharePoint Online?
Thanks in advance- dcancelosCopper Contributor
Thomsch, back in the day I used this page to set it up. In theory it still works. https://www.spguides.com/script-editor-web-part-sharepoint-2016/