-1

my need is the following: i have two external resources that i can't put in static resources because they can be updated by a third party at any moment (they are not libraries) I put these two resources in the header of my community because these tags aren't accepted in lwc.

<link rel='stylesheet' id='xxx-css' href='https://www.xxx.com/xxx/xxx/css/' type='text/css' media='all' />

<script type='text/javascript' src='https://www.xxxxx.com/xxx/xxx/js/' id='xxxx-js' />

and to display the rendering of all this, i need to create a lwc with only one tag

<div class="js-xxx" />

I tested and I have no rendering, I put the url of the script and the trusted site in the community and in salesforce to be sure. so my question is : can I access the script from an lwc ? and if it is not possible what solution do I have

Thanks for your help :)

1

No, the CSP (Content Security Policy) does not allow external scripts. This is a security feature. You can add CSP Trusted Sites, but you must still host the core application in a Static Resource; with connect-src enabled, it can reach the third-party server.

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.