首頁  >  文章  >  web前端  >  AngularJS iframe跨域打开内容时报错误的解决办法_AngularJS

AngularJS iframe跨域打开内容时报错误的解决办法_AngularJS

WBOY
WBOY原創
2016-05-16 16:18:101264瀏覽

打开不同域的内容时报下面的错误:

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/**']);
});

很简单的方法就解决了angularjs跨域使用iframe的问题,希望大家能够喜欢

陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn