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。这是我遇到的类似问题(链接),但是我我不知道应该如何解决这个问题。
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()
解析网址,甚至提供绝对值例如, 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.
我正在使用角度ui-router版本0.2.18和角度1.5。
I’m using angular ui-router version 0.2.18 and angular 1.5.
请分享您的宝贵意见。
Please share your valuable inputs.
谢谢!
我有同样的问题并且能够解决它(在 Angular.js,iframes和Firefox )。 iframe需要知道FF和IE中的默认页面。我们是一个托管角度应用程序的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: