Over the weekend the following formula field building a link stopped working on iPad.
IF (ShowCustomLink__c, HYPERLINK("/apex/MyVfPage?id="&Id + "&var1=val1" + "&var2="&Name, IMAGE("/resource/ResourceWithButtonImages", "Alt Text"),"_self"), NULL)
This formula field generates the following markup:
<a href="javascript:void(0)" ontouchstart="javascript:{ var openEvent =
$A.get('e.force:navigateToURL'); openEvent.setParams({'url':'/apex/MyVfPage?
id=[SfIdHere]&var1=val1&var2=val2'});openEvent.fire();}" data-aura-
rendered-by="394:282;a"><img src="/resource/ResourceWithButtonImages"
alt="Alt Text" border="0"></a>
Using my Mac and Safari dev tools to inspect and view the browser console I see the following two errors.
Refused to execute inline event handler because it violates the following
Content Security Policy directive: "script-src 'self' chrome-extension:
https://sfdc.azureedge.net *.na30.visual.force.com
https://ssl.gstatic.com/accessibility/".
Refused to execute JavaScript URL because it violates the following Content
Security Policy directive: "script-src 'self' chrome-extension:
https://sfdc.azureedge.net *.na30.visual.force.com
https://ssl.gstatic.com/accessibility/".
I brushed up on my understanding of Content Security Policy directive script-src and determined that the markup generated by the formula field HYPERLINK
function is causing the violations by using the inline ontouchstart
event and the javascript:
in the href attribute. I suspect SF changed the Content Security Policy header at some point causing this to break. Any suggestions on a workaround to this problem or another way to build the hyperlink so it is compliant with the CSP header?
<lightning:select>
when used inlightning out
as well....(unfortunately there is no-one to tell these issues to) No an answer but a spot for you to start investigating.....