在给cesium使用html2canvas插件加截图保存控件时,提示错误Blocked script execution in 'about:blank' because the document's frame is sandboxed and the 'allow-scripts' permission is not set.
一、分析:因为infoBox是Ifram框架,H5的新安全机制不允许在其中执行脚本,如果在里面写了类似于点击事件的脚本,则会提示如下错误:Blocked script execution in 'about:blank' because the document's frame is sandboxed and the 'allow-scripts' permission is not set.
二、解决方法有两个:
1.禁用infobox,自己设计信息面板。
2.设置沙箱的权限
var iframe = document.getElementsByClassName('cesium-infoBox-iframe')[0];
iframe.setAttribute('sandbox', 'allow-same-origin allow-scripts allow-popups allow-forms');