Content Security Policy directive: "frame-ancestors 'self'

前端 未结 2 1988
眼角桃花
眼角桃花 2020-12-31 00:46

I am embedding an iFrame in my web page, something like this:

var iframeProps = {
        \'data-type\': self.props.type,
        allowTransparency: self.pro         


        
2条回答
  •  爱一瞬间的悲伤
    2020-12-31 00:57

    I encountered with this problems recently too and i didn't find any alternative method to solve that.Finally, I came up with idea that the attribute in the iframe,which is "src",can be filled with the origin html content and it works.

    // this demo shows the process of getting the html content 
    // from the link,and then apply it to the attribute "src" in the iframe
    $.get(link, function (response){ 
    var html = response;
    var html_src = 'data:text/html;charset=utf-8,' + html;
    $("#iframeId").attr("src" , html_src);
    });

提交回复
热议问题