Overcoming “Display forbidden by X-Frame-Options”

后端 未结 26 2317
梦谈多话
梦谈多话 2020-11-21 06:31

I\'m writing a tiny webpage whose purpose is to frame a few other pages, simply to consolidate them into a single browser window for ease of viewing. A few of the pages I\'

26条回答
  •  时光取名叫无心
    2020-11-21 07:31

    Not mentioned but can help in some instances:

    var xhr = new XMLHttpRequest();
    xhr.onreadystatechange = function() {
        if (xhr.readyState !== 4) return;
        if (xhr.status === 200) {
            var doc = iframe.contentWindow.document;
            doc.open();
            doc.write(xhr.responseText);
            doc.close();
        }
    }
    xhr.open('GET', url, true);
    xhr.send(null);
    

提交回复
热议问题