When using the $Asset global variable in Visualforce, it looks like Salesforce is trying to load resources from na38.salesforce.com instead of c.na38.visual.force.com. This is causing it to violate the CORS policy on na38.salesforce.com and fail to load resources. Has anybody else seen this/have a workaround? Images load fine when using the merge field directly via URLFOR() but adding icons in javascript fails and the fonts fail to load.

Update with Sample Code

  <div class="slds-scope" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
    <h1 class="slds-text-heading--large">
      Hello world
    <div id="img">
      <img src="{!URLFOR($Asset.SLDS, 'assets/images/avatar1.jpg')}" alt="Contact Avatar"/>
    <div id="svg">
      <span class="slds-icon_container slds-icon-standard-account" title="description of icon when needed">
        <svg class="slds-icon" aria-hidden="true">
          <use xlink:href="{!URLFOR($Asset.SLDS, '/assets/icons/standard-sprite/svg/symbols.svg#account')}"></use>
        <span class="slds-assistive-text">Description of icon</span>

You will see that the image tag loads fine but the svg fails with

Unsafe attempt to load URL https://app-dev-dsh0-dev-ed.my.salesforce.com/apexpages/slds/2.1.3/assets/icons/standard-sprite/svg/symbols.svg from frame with URL https://app-dev-dsh0-dev-ed--c.na38.visual.force.com/apex/sldstest. Domains, protocols and ports must match.

  • 1
    Can you add your markup/script here just to be explicit?
    – Adrian Larson
    Feb 8, 2017 at 0:59
  • Added a reduced test case.
    – dsharrison
    Feb 8, 2017 at 1:11

1 Answer 1


I'm a platform developer. We're tracking this with bug W-3638602, and hope to get a fix in soon. Look for it in the next week.

After the fix, SLDS resources will be served from c.na38.visual.force.com, the same as your Visualforce page.

Thank you for catching this bug!

  • 3
    Always good to see more SFDC R&D on SFSE. Thanks for joining to chime in! Feb 8, 2017 at 19:51
  • 1
    Could you add a link to the issue? Could not find it in salesforce
    – juvian
    Feb 13, 2017 at 17:35
  • @juvian bugs aren't automatically posted as known issues - the support team owns those, and somebody would need to ask them (via case generally) to create one for it to happen. The internal bugs often aren't that useful directly without being translated to customer-impacting terms. Feb 17, 2017 at 18:15
  • @ca_peterson I see, guess I will be waiting for a fix then. Thanks for the response
    – juvian
    Feb 18, 2017 at 4:41
  • The cors issue with apex:slds / $asset.slds appears to be fixed in the Spring17 release (just tested it as part of a managed package). Mar 1, 2017 at 8:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .