简体   繁体   English

Angular JS:iframe无法在Firefox和IE 11中运行

[英]Angular JS : iframe not working in Firefox and IE 11

I'm having an iframe in an uibmodal, to which I'm providing a static HTML path (in the same domain). 我在uibmodal中有一个iframe,我正在提供一个静态HTML路径(在同一个域中)。 The URL works correctly in Safari, Chrome and iOS Devices. 该URL可在Safari,Chrome和iOS设备中正常运行。 However, it doesn't load in Firefox and IE11. 但是,它不会在Firefox和IE11中加载。

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. 在做了一些研究后,我知道这是因为ui-router,它无法转到我提供的相对URL。 Here's a similar question which I came across ( link ) , however I don't know how I should go about fixing it. 这是我遇到的类似问题( 链接 ),但我不知道应该如何修复它。

I've tried to parse the URL using $sce.trustAsResourceUrl() , and even by giving an absolute path eg. 我试图使用$sce.trustAsResourceUrl()解析URL,甚至通过提供绝对路径,例如。 http://localhost:3000/#mySamplePage . http:// localhost:3000 /#mySamplePage It still loads in Chrome but fails to load on Firefox and IE11. 它仍然在Chrome中加载,但无法在Firefox和IE11上加载。 Also the thing to note is that there aren't any errors in the console. 另外需要注意的是控制台中没有任何错误。

I'm using angular ui-router version 0.2.18 and angular 1.5. 我正在使用角度ui-router版本0.2.18和角度1.5。

Please share your valuable inputs. 请分享您的宝贵意见。

Thanks! 谢谢!

I had the same issue and was able to solve it (with help from Angular.js, iframes and Firefox ). 我有同样的问题,并能够解决它(在Angular.js,iframes和Firefox的帮助下)。 The iframe needs to know the default page in FF and IE. iframe需要知道FF和IE中的默认页面。 Ours is an mvc app hosting the angular app so the url for our iframe needed the default controller: 我们是一个托管角度应用程序的mvc应用程序,因此我们的iframe的url需要默认控制器:

http://localhost:8000/mvc/Controller/#/mySamplePage HTTP://本地主机:8000 / MVC /控制器/#/ mySamplePage

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM