javascript - Angular JS : iframe not working in Firefox and IE 11

标签 javascript angularjs iframe angular-ui-router

我在 uibmodal 中有一个 iframe,我为其提供静态 HTML 路径(在同一域中)。该 URL 在 Safari、Chrome 和 iOS 设备中正常工作。但是,它无法在 Firefox 和 IE11 中加载。

经过一些研究,我发现这是因为 ui-router 导致它无法访问我提供的相对 URL。这是我遇到的类似问题(link),但我不知道应该如何解决它。

我尝试使用 $sce.trustAsResourceUrl() 解析 URL,甚至给出绝对路径,例如 http://localhost:3000/#mySamplePage 。它仍然可以在 Chrome 中加载,但无法在 Firefox 和 IE11 上加载。另外需要注意的是控制台中没有任何错误。

我正在使用 Angular ui-router 版本 0.2.18 和 Angular 1.5。

请分享您的宝贵意见。

谢谢!

最佳答案

我遇到了同样的问题并且能够解决它(在 Angular.js, iframes and Firefox 的帮助下)。 iframe需要知道FF和IE中的默认页面。我们的应用程序是一个托管 Angular 应用程序的 MVC 应用程序,因此 iframe 的 url 需要默认 Controller :

http://localhost:8000/mvc/Controller/#/mySamplePage

关于javascript - Angular JS : iframe not working in Firefox and IE 11,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40495826/

相关文章:

javascript - 如何在按钮单击时以 Angular 动画背景变化效果

javascript - 如何跳过 highcharts.js 中的值?

javascript - org.thymeleaf.exceptions.TemplateInputException : Exception parsing document: template ="result", 第 28 行 - 第 23 列

javascript - Angular.js 共享 Controller 方法

javascript - Django View 未从 Angularjs $http 请求接收数据

php - 如何从主框架中的 iframe 运行 js 函数?

python - 问 : How can I create dynamically an iframe inside a web content using Python?

javascript - 垂直对齐图像 hover img

javascript - 插入或保存到 mongodb 返回 500 服务器错误

c# - 被youtube重叠的modalpopupextendar嵌入iframe