Angular JS:iframe 在 Firefox 和 IE 11 中不起作用
我在 uibmodal 中有一个 iframe,我向它提供了一个静态 HTML 路径(在同一个域中).该 URL 在 Safari、Chrome 和 iOS 设备中正常工作.但是,它不会在 Firefox 和 IE11 中加载.
I'm having an iframe in an uibmodal, to which I'm providing a static HTML path (in the same domain). The URL works correctly in Safari, Chrome and iOS Devices. However, it doesn't load in Firefox and IE11.
经过一些研究,我知道这是因为 ui-router 无法访问我提供的相对 URL.这是我遇到的一个类似问题 (link),但是我不知道我应该如何修复它.
After doing some research I got to know that it's because of ui-router that it's not able to go to the relative URL which I'm providing. Here's a similar question which I came across (link) , however I don’t know how I should go about fixing it.
我尝试使用 $sce.trustAsResourceUrl()
解析 URL,甚至通过提供绝对路径,例如.http://localhost:3000/#mySamplePage.它仍然可以在 Chrome 中加载,但无法在 Firefox 和 IE11 上加载.另外需要注意的是,控制台中没有任何错误.
I’ve tried to parse the URL using $sce.trustAsResourceUrl()
, and even by giving an absolute path e.g.. http://localhost:3000/#mySamplePage. It still loads in Chrome but fails to load on Firefox and IE11. Also the thing to note is that there aren’t any errors in the console.
我使用的是 angular ui-router 版本 0.2.18 和 angular 1.5.
I’m using angular ui-router version 0.2.18 and angular 1.5.
请分享您的宝贵意见.
谢谢!
我遇到了同样的问题并且能够解决它(在 Angular.js、iframes 和 Firefox).iframe 需要知道 FF 和 IE 中的默认页面.我们是一个托管 angular 应用程序的 mvc 应用程序,因此我们的 iframe 的 url 需要默认控制器:
I had the same issue and was able to solve it (with help from Angular.js, iframes and Firefox). The iframe needs to know the default page in FF and IE. Ours is an mvc app hosting the angular app so the url for our iframe needed the default controller: