1

I am developing a provider hosted SharePoint add-in part. I am using the SharePoint site's stylesheet in the add-in part to make it look similar to the site. I have followed the example provided in the following msdn doc -

https://msdn.microsoft.com/en-us/library/office/fp179898.aspx

Some styles like the background are applied. However the font styles of the site does not apply. I get this error in the console -

Font from origin 'https://wazokuhq-d5bb120d73abbd.sharepoint.com' has been blocked from loading by Cross-Origin Resource Sharing policy: No 'Access-Control-Allow-Origin'

I am testing the add-in part in a Sharepoint Online tenant.

Can anybody suggest how to resolve this issue ?

2 Answers 2

0

Fonts in SharePoint online can not be stored outside SharePoint. Therefore you need to download the font to your SharePoint online site or directly (recommended) in your app before you can use them.

Remember to include all the different fonts for different browsers.

0

WOFF (Font) files are considered a bit insecure, so by default most modern browsers (past couple of years) will now block them with a Cross-Origin warning.

Although your App Web has some access to the Host Web, they are foreign websites to eachother, thus all CORS restrictions apply when you pull content in.

You either

  • have to download the WOFF files

or

..

I haven't looked into this

Maybe those SharePoint Font files are available from the Microsoft CDN as well, and (maybe) served with CORS headers.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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