Refused to display because an ancestor violates the following Content Security問題簡單解決


 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>

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM