• Ron McCrerey
  • NEWBIE
  • 20 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 3
    Replies
Working in Lightning.
I have a an embedded visualforce page.
I need to do page refresh on the container page.
Can anyone give an example of how to do this?
How do I form a SOQL query for the child of Product2 whose parent is a Product2?
I have a Zipped Static Resource which includes a .js file and several images.  The images load fine from the HTML with following :
<img src = "{!URLFOR($Resource.images,'img/')}ToolBumper24S7DS120x140.png"/>

but the following code in Javascript produces an undefined error.

image.onload = image.addEventListener("load", function(){                                 
          canvas.drawImage(image, x, y, w, h);
          }, false);
          
image.onload =  image.addEventListener("error", function(e){
          console.log("error loading image " + is + "  " + JSON.stringify(e) );
});

image.src = "{!URLFOR($Resource.images,'img/')}ToolBumper24S7DS120x140.png";

Why does the image not load?

 
I am tyring to load a compiled Angular 5 SPA in a lightning:container, however I am experiencing issues when attempting to load the index.html from my app which is preventing loading additional files from the static resource.
Lightning app:
<aura:application access="global" >
    <lightning:container src="{!$Resource.myApp+ '/index.html'}"/>
</aura:application>
index.html
<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>myApp</title>
  <base href="/">

  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="icon" type="image/x-icon" href="favicon.ico">
</head>
<body>
  <app-root></app-root>
<script type="text/javascript" src="/resource/myApp/inline.bundle.js"></script>
<script type="text/javascript" src="/resource/myApp/polyfills.bundle.js"></script>
<script type="text/javascript" src="/resource/myApp/styles.bundle.js"></script>
<script type="text/javascript" src="/resource/myApp/vendor.bundle.js"></script>
<script type="text/javascript" src="/resource/myApp/main.bundle.js"></script>
</body>
</html>
Refused to load the script 'https://<mySandbox>.cs50.visual.force.com/resource/myApp/inline.bundle.js' because it violates the following Content Security Policy directive: "script-src 'self' 'unsafe-eval' 'nonce-70d472c7a148692e788790dca2cfbccb38ce420488c12502a4abbec1d5fb32a7'".
Is there any way to do this corretly such that the scripts for my angular 5 app can load and run in the lightning-container?
How do I form a SOQL query for the child of Product2 whose parent is a Product2?
I have a Zipped Static Resource which includes a .js file and several images.  The images load fine from the HTML with following :
<img src = "{!URLFOR($Resource.images,'img/')}ToolBumper24S7DS120x140.png"/>

but the following code in Javascript produces an undefined error.

image.onload = image.addEventListener("load", function(){                                 
          canvas.drawImage(image, x, y, w, h);
          }, false);
          
image.onload =  image.addEventListener("error", function(e){
          console.log("error loading image " + is + "  " + JSON.stringify(e) );
});

image.src = "{!URLFOR($Resource.images,'img/')}ToolBumper24S7DS120x140.png";

Why does the image not load?