0

We have font definition files that are referenced from a CSS file that is included in our SharePoint Online Master Page. They are .woff, .svg, .avg, .ttf, .otf. The CSS is loaded with CSS Registration like this:
<SharePoint:CssRegistration Name="/Style%20Library/content/app/css/app.css" runat="server"/>

For some reason SharePoint will append a 25 to the Style Library path where we have the fonts stored where the HTTP escape code for space is, turning %20, or space, into %2520. "Style Library" is the only part of the URL with a space in it.

While it should be /Style%20Library/ it's coming as /Style%2520Library/

In the CSS file, which is in a folder under "Style Library", they are referenced like this:

@font-face {
    font-family: "Effra Light";
    src: url(../css/fonts/Effra_Std_Lt.woff), 
         url(../css/fonts/Effra_Std_Lt.svg), 
         url(../css/fonts/Effra_Std_Lt.ttf), 
         url(../css/fonts/Effra_Std_Lt.eot), 
         url(../css/fonts/Effra_Std_Lt.otf);
}

And finally I've noticed that this error does not happen as frequently when directly opening a page via a URL for the first time. It happens more frequently when a Page is re-loaded by SharePoint, like when a User clicks on a List operation or changes the Page to Edit Page mode. Obviously, one of the SharePoint mechanics is altering the URL. How to prevent this?

Perhaps a related ticket here

1

I had the same problem. In the masterpage, we had this:

<SharePoint:CssRegistration Name="<% $SPUrl:~sitecollection/Style%20Library/Branding/css/Seattle.css %>" runat="server" />

For some reason, SharePoint re codifies the %20 adding %2520 that gives error in some cases not loading the CSS.

To solve this, replace the %20 for a space in the registration, like this:

<SharePoint:CssRegistration Name="<% $SPUrl:~sitecollection/Style Library/Branding/css/Seattle.css %>" runat="server" />

SharePoint will transform Style Library to Style%20Library automatically without the 25, doing the trick and working just fine.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.