带有Internet Explorer 11的Angularjs的安全问题 [英] Angularjs with Internet Explorer 11, security issue

查看:102
本文介绍了带有Internet Explorer 11的Angularjs的安全问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Angularjs已有数月了,它在Chrome/Firefox/Safari中像超级按钮一样工作,但是在IE11和Edge上却遇到了一些问题.

似乎我的问题出在ng-src上,因为未显示图像并且从未设置src属性.

这是代码:

 <div class="cell col-xs-12 col-sm-6 col-md-4 col-lg-3" ng-repeat="obj in DATA.objects | orderBy:objectsOrder track by $index ">
    <div ng-click="setCurrent($event, obj, '{{'obj_nav_' + $index}}')">
        <img ng-src="{{formatURL(obj.Id, obj.img.fileName)}}"></img>
        <div>
            <p ng-bind="obj.name"/>
            <p ng-bind="obj.address"/>
        </div>
    </div>
 </div>

formatURL是作用域函数,用于格式化URL以获取图像,例如,格式化的URL将为" https://user1:mdp@mydomain.com/objId/imageName ".

这是错误:

错误:发生了安全问题.

在Aa( http://192.168.9.97 /web/app/lib/angular/angular.min.js:147:46 ) 在匿名函数中( http://192.168.9.97/web /app/lib/angular/angular.min.js:137:142 ) 在Z.prototype.$ set( http://192.168 .9.97/web/app/lib/angular/angular.min.js:76:149 ) 在匿名函数中( http://192.168.9.97/web /app/lib/angular/angular.min.js:242:344 ) 在匿名函数中( http://192.168.9.97/web /app/lib/angular/angular.min.js:77:72 ) 在m( http://192.168.9.97/web/app/lib/angular/angular.min.js:7:320 ) 在Z.prototype.$ set( http://192.168 .9.97/web/app/lib/angular/angular.min.js:77:49 ) 在匿名函数中( http://192.168.9.97/web /app/lib/angular/angular.min.js:71:500 ) 在匿名函数中( http://192.168.9.97/web /app/lib/angular/angular.min.js:95:444 ) 在匿名函数中( http://192.168.9.97/web /app/lib/angular/angular.min.js:128:156 )

此错误消息是使用Angularjs 1.4.7引发的.请注意,当我第一次遇到问题时,我使用的是1.3.0-rc5,然后我更新了Angular,但仍然遇到相同的问题.我在Edge中遇到了完全相同的错误.

解决方案

我终于在这里找到了答案 http://login:password @ url 格式来防止隐藏URL.

I'm using Angularjs for some months and it works like a charms in Chrome/Firefox/Safari but face some problems with IE11 and Edge.

It seems my problem come from ng-src since images are not displayed and src attribute is never set.

Here is the code:

 <div class="cell col-xs-12 col-sm-6 col-md-4 col-lg-3" ng-repeat="obj in DATA.objects | orderBy:objectsOrder track by $index ">
    <div ng-click="setCurrent($event, obj, '{{'obj_nav_' + $index}}')">
        <img ng-src="{{formatURL(obj.Id, obj.img.fileName)}}"></img>
        <div>
            <p ng-bind="obj.name"/>
            <p ng-bind="obj.address"/>
        </div>
    </div>
 </div>

formatURL is a scope function that format the URL to get images, for instance the formatted url will be "https://user1:mdp@mydomain.com/objId/imageName".

Here is the error:

Error: A security issue has occurred.

at Aa (http://192.168.9.97/web/app/lib/angular/angular.min.js:147:46) at Anonymous function (http://192.168.9.97/web/app/lib/angular/angular.min.js:137:142) at Z.prototype.$set (http://192.168.9.97/web/app/lib/angular/angular.min.js:76:149) at Anonymous function (http://192.168.9.97/web/app/lib/angular/angular.min.js:242:344) at Anonymous function (http://192.168.9.97/web/app/lib/angular/angular.min.js:77:72) at m (http://192.168.9.97/web/app/lib/angular/angular.min.js:7:320) at Z.prototype.$set (http://192.168.9.97/web/app/lib/angular/angular.min.js:77:49) at Anonymous function (http://192.168.9.97/web/app/lib/angular/angular.min.js:71:500) at Anonymous function (http://192.168.9.97/web/app/lib/angular/angular.min.js:95:444) at Anonymous function (http://192.168.9.97/web/app/lib/angular/angular.min.js:128:156)

This error message was thrown using Angularjs 1.4.7. Note that I was using 1.3.0-rc5 when I first faced the problem then I update Angular but still got the same problem. I got exactly the same error in Edge.

解决方案

I finally found the answer here Microsoft. Microsoft doesn't allow user to use http://login:password@url format to prevent hidden url.

这篇关于带有Internet Explorer 11的Angularjs的安全问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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