1

我在此页面上运行以下javascript代码(在 google Chrome 中)并在控制台中收到以下错误:

Resource interpreted as Document but transferred with MIME type application/json:

我的代码中的所有内容都可以正常工作,直到它尝试刷新 iframe。那是我收到消息的时候。为了更容易查看,我已经大大缩短了我的代码:

var filePath = document.URL;

var ifram = '<iframe id="frame" width="100%" height="1" scrolling="yes"></iframe>';
document.write(ifram);
var iframe = parent.document.getElementById("frame");
iframe.height = 600;
iframe.width = '60%';
iframe.src = filePath;

function search_prices(){
    var given_info = iframe.contentDocument.getElementsByTagName("pre")[0].innerHTML;
    var item_info = JSON.parse(given_info);
    setTimeout("iframe.src = filePath;", 500);
}

iframe.onload = search_prices;

我调查了关于相同错误的类似问题,但我无法找到任何对我有帮助的东西,因为我无法控制服务器。页面上的信息是我必须使用的。

4

0 回答 0