亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

無法成功嵌入/顯示 POWR.io 評論

無法成功嵌入/顯示 POWR.io 評論

Cats萌萌 2023-06-15 10:30:28
對于遇到這個問題的任何人,希望這能找到你。我創建了一個快速的小 test.html 文件并在 Chrome 中打開它。它包括以下片段,我無法顯示任何內容。<div?class="powr-reviews"?id="2753c372_1606181564"></div> <script?src="https://www.powr.io/powr.js?platform=html"></script>任何和所有幫助將不勝感激。
查看完整描述

1 回答

?
縹緲止盈

TA貢獻2041條經驗 獲得超4個贊

var theFrame=document.createElement('iframe')

theFrame.src="https://www.powr.io/reviews/i/26790199#page"

document.body.appendChild(theFrame)


//document.appendChild isn't reliable since it says some ONLY ALLOWS ONE APPENDAGE or something like that

//the above code only works if cors doesn't block you, meaning that your source for this would be from powr.io as well(THIS IS A SANDBOX SO IT GETS BLOCKED BECAUSE OF ORIGIN DIFFERENCE)


//if i run the code below, it works on newtab(if u pop up the console paste and enter)

document.write('<div class="powr-reviews" id="2753c372_1606181564"></div>')

var x=document.createElement('script')

x.src="https://www.powr.io/powr.js?platform=html"

document.body.appendChild(x)

現在我有一個小的repl來表明你的 2 行工作,但如果你的源(在客戶端運行它時的原點)是文件,它就不起作用

現在在下面,我嘗試模仿代碼到底做了什么

JavaScript 示例及其repl

//iframe loader

function iframer(sourceUrl){

? document.body.innerHTML="" //makes sure ONLY this loads

? var iframe = document.createElement('iframe');

? iframe.src = sourceUrl;

? iframe.width=screen.availWidth;

? iframe.height=screen.availHeight;

? iframe.style="border: solid transparent";

? document.body.appendChild(iframe);

? return iframe;

}

var myFrame=iframer("https://www.powr.io/reviews/i/26790199#page")

console.log(myFrame)

HTML 示例及其repl


<meta?http-equiv="refresh"?content="0;URL='https://www.powr.io/reviews/i/26790199#page'">


查看完整回答
反對 回復 2023-06-15
  • 1 回答
  • 0 關注
  • 129 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號