Angular JS:iframe无法在Firefox和IE 11中运行 [英] Angular JS : iframe not working in Firefox and IE 11

查看:97
本文介绍了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:

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

这篇关于Angular JS:iframe无法在Firefox和IE 11中运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆