javascript - 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:
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:
If both site-1 and site-2 are on the same machine.
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/
解决方案
我有类似的问题。您可以尝试在另一个选项卡中加载 iframe 子应用程序(站点 2)并刷新以查看 iframe 是否会相应加载。这对我们有用。
推荐阅读
- javascript - 定期更改集合 Firestore 中文档的字段 - Cloud Functions
- python - 使用 Numba Python 提高 Numpy 函数的性能
- azure-devops - 在 Azure DevOps 上发布文件,无需访问 DevOps 帐户即可通过机器下载
- opengl - 着色器程序是否应该在 OpenGL 中共享
- swift - 非连续数字和非重复数字的 Swift 正则表达式
- discord.js - booru discord.js 中不推荐使用的 commonfy 函数
- flutter - Flutter 中的数据表溢出
- c# - 用于下次启动的安全随机字符串 - C# / VB.Net
- reactjs - useState setter 函数在使用扩展运算符和多个 if 语句时不更新状态?
- python - PySpark - 从值列表中检查数据框的任何列中是否存在