I have loaded svg in static resource in salesforce and need to use the same in lwc.We were using
<lightning-icon> to render it.This was working previously but now it throws the following error.
Unsafe attempt to load URL https://test-example.visualforce.com/resource/998787876/iconbill from frame with URL https://test-example.lightning.force.com/lightning/n/lwc_page. Domains, protocols and ports must match.
I have tried the methods from documentation like below
but that also throws the following error Access to XMLHttpRequest at 'https://test-example.lightning.force.com/visualforce/session?url=httpsexample-test--c.visualforce.com8979687iconimg' (redirected from 'https://example-test--c.visualforce.com/resource/998787876/iconimg') from origin 'https://test-example.lightning.force.com' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
Can anyone please let me know if there is any way to import svg from static resource and display it in LWC.We have a req where we the image changes based on different value so we cannot hardcode the svg in the html also.
It works in classic rendered lwc but in lightning it gives error and it is not rendered.