首页 > 解决方案 > Unable to load local website inside Iframe in Edge

问题描述

I've two sites site-1 (Parent) and site-2 (child). Both are hosted on two machines on IIS V10 (windows 10) on the same network. Site-2 is loaded inside site-1 using Iframe.

The site-2 is loaded in Iframe in all browsers (Chrome, Firefox, IE) but Edge. I get following error in Edge: enter image description here

Here, I am using IP address and port for the site-2 in the iframe instead of the hostname.

Here is how I am creating Iframe in JS:

var elem = document.createElement("iframe");
elem.setAttribute("src", "http://172.18.48.43:5051/play/Web/21");
elem.setAttribute("id", "site-2");
elem.style.width = 800 + "px";
elem.style.height = 300 + "px";
elem.style.border = 1 + "px solid Orange";
var frame = document.getElementById('frame');
$("#frame").html(elem);

The Iframe works in edge in two conditions:

  1. If both site-1 and site-2 are on the same machine.

  2. If instead of IP, I use public domain hostname like http://www.some-domain.com

I tried following solutions, but nothing worked so far:

https://windowsreport.com/fix-hmm-we-cant-reach-this-page-edge/

https://troubleshooter.xyz/wiki/fix-hmm-we-cant-reach-this-page-error-in-microsoft-edge/

Why does Microsoft Edge open some local websites, but not others, where the domain name is routed to 127.0.0.1 in hosts file

标签: javascriptwindowsiisiframemicrosoft-edge

解决方案


我有类似的问题。您可以尝试在另一个选项卡中加载 iframe 子应用程序(站点 2)并刷新以查看 iframe 是否会相应加载。这对我们有用。


推荐阅读