我通过jQuery在iframe中加载我的嵌入代码,如下所示
<div id="My-page" style="width:900px; height:900px; position: absolute;overflow-x:hidden !important;-webkit-overflow-scrolling:touch !important;" class="iframely-widget-container">
<script>
$("#My-page").empty().append($("<iframe/>", {
src: "http://localhost/flipbeets3.0.com/get-embedded-code/abdul/p~2~2~2?slug-hash=HrFBx&default-tab=result&host=http%3A%2F%2Fcodepen.io"
}));
</script>
</div>
它显示不允许的关键字符错误
当您通过javascript加载URL时,无需对其进行编码。此代码应该适合您:
<div id="My-page" style="width:900px; height:900px; position: absolute;overflow-x:hidden !important;-webkit-overflow-scrolling:touch !important;" class="iframely-widget-container"></div><script>$("#My-page").empty().append($("<iframe/>", {src: "http://localhost/flipbeets3.0.com/get-embedded-code/abdul/p~2~2~2?slug-hash=HrFBx&default-tab=result&host=http://codepen.io"}));</script>