salesforce的home页嵌套visualforce page
基本操作如下:
1、在Home Page Components里添加一个类型为Visualforce Area的自定义组件Custom Components
2、Home Page Layouts里指定自定义的Components
3、指定相应角色的Home Layout
问题及解决方案:
1、自定义visualforce page到Home Layout后并不能如愿看到,会提示错误“Refused to display in a frame because an ancestor violates the following Content Security Policy directive”
分析:原理为iframe嵌套网页,说明跨域了。因为系统自带的页面如home的域名与自定义的visualforce page不同,如home为https://abiapac--devindunis.cs75.my.salesforce.com自定义的page为https://abiapac--devindunis--c.cs75.visual.force.com。
解决:Session Settings里关闭如下两项(不开启“点击劫持”)
2、页面基本可展示了,但会提示“Javascript proxies were not generated for controller IN_OntabBaseKpiDashboardController: may not use public remoted methods inside an iframe.”
分析:public remoted methods不能生成Javascript proxies
解决:将remote方法及对应的class都设置为global(包括上级及返回类型的class)
效果:
参考:
Refused to display in a frame
Javascript proxies were no generated for controller
https://developer.salesforce.com/forums/?id=906F000000092ZfIAI