1

at the moment I try to develop a SharePoint 2016 Visual Web Part project (my first time).

I define the content from this Visual Web Part withe JavaScript, becaue I have to build a SVG element by means of a JSON file. The JSON file is currently hosting a SharePoint document library (to make it easy).

The SVG contains a elements wich contains poligones to build clickable poligons in vector graphic.Now to my problem. The polygons in the SVG element will not displayed. I hosted the generated SVG element in an external html file to find out why it is not presend.

In the external html file i dont have any problems with the SVG element. Only SharePoint does not show the polygons inside the svg. Last, I found out that the polygons are displayed when I move them out of the a element.

Any idea why SharePoint can't display the polygons inside the svg?

<svg xmlns="http://www.w3.org/2000/svg" width="500" height="400" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1">
<a xlink:href="https://google.de" target="_blank" >
    <polygon points="0,0 20,0 20,20 0,20" />
</a>
<a xlink:href="#" target="_self">
    <polygon points="20,0 40,0 40,20 20,20" />
</a>

I also tried it to put the generadet SVG in a Content Editor Web Part. There I have no problems. I can not explain the behavior. Lastly, I've done my JavaScript in the Content Management Web Part to check if my JS is doing something wrong. However, it works in the Content Management Web Part.

  • Tried to copy the SVG element from your sample to a content editor web part and it gets displayed correctly. I think I must be missing something here. When you display the svg inside the visual web part, you have checked that the output source code for the page matches your expectation? – SPArchaeologist-様 Jan 31 at 10:33
  • Yes I have checked, I have also compared it with a working version. However could not find a difference. – Nyxero Jan 31 at 10:41
  • I also tried it in a Content Editor Web Part. There I have no problems. I can not explain the behavior. I'm just trying to adjust my JS and do that in the Content Editor Web Part. Maybe then I'll learn more. – Nyxero Jan 31 at 11:49
  • Lastly, I've done my JavaScript in the Content Management Web Part to check if my JS is doing something wrong. However, it works in the Content Management Web Part. – Nyxero Jan 31 at 11:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.