0

I am trying to load an external script, the script looks loaded properly. however, can't access the object & it's methods in that script. The script is loaded with attribute "locker-data-src" & not with a "src". Does that make any difference?

2
  • 1
    See if this answer helps you : salesforce.stackexchange.com/questions/263719/… Can you share your code? Commented Feb 19, 2020 at 7:01
  • Yes, that helps! But I am able to load the script, the problem is with the attribute "locker-data-src". How can I get rid of it & just have the src attribute?
    – Asra
    Commented Feb 20, 2020 at 6:27

1 Answer 1

0

Lightning Locker takes control of the src attribute on the HTMLScriptElement tag to load and evaluate the script in the sandbox. The original src attribute is reflected to the locker-data-src attribute.

It's not possible to set directly the src attribute because it would mean that the loaded script would execute outside the sandbox.

You must log in to answer this question.

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