http的iframe中訪問https頁面簡單解決辦法
在公司雲平台(微信企業號及公眾號管理)上需要顯示其他公眾號微信文章,正常來說直接在富文本編輯器中設置超連接是沒問題的,但是微信文章是https開頭,而服務器http開頭,導致頁面報錯:
Refused to display 'https://mp.weixin.qq.com/xxx' in a frame because an ancestor violates the following Content Security Policy directive: "frame-ancestors 'self'
解決方案:在頁面中設置meta ,url可動態設置
<meta http-equiv="refresh" content="0;url=${contentColumn.URL}">
iframe設置如下:
<iframe src="${contentColumn.URL}" frameborder="0" scrolling="no" style="width: 100%;height: 100%"></iframe>