[原]AngularJS iframe打开不同域的内容时报错误
<iframe id="myFrame" ng-src="{{url}}" width="100%" height="100%" seamless frameborder="0" ></iframe>
打开不同域的内容时报下面的错误:
Blocked loading resource from url not allowed by $sceDelegate policy
Blocked loading resource from url not allowed by $sceDelegate policy
app.config(function($sceDelegateProvider) {
$sceDelegateProvider.resourceUrlWhitelist([
// Allow same origin resource loads.
'self',
// Allow loading from our assets domain. Notice the difference between * and **.
'http://media.w3.org/**']);
});
$sceDelegateProvider.resourceUrlWhitelist([
// Allow same origin resource loads.
'self',
// Allow loading from our assets domain. Notice the difference between * and **.
'http://media.w3.org/**']);
});
[参考]:
http://stackoverflow.com/questions/21884666/angular-js-handling-ng-repeated-html5-video-sce
作者:wintys (wintys@gmail.com)
出处:http://wintys.cnblogs.com
欢迎转载,转载请注明作者及出处。