Home  >  Article  >  Web Front-end  >  Solution to error when opening content in AngularJS iframe across domains_AngularJS

Solution to error when opening content in AngularJS iframe across domains_AngularJS

WBOY
WBOYOriginal
2016-05-16 16:18:101306browse

When opening content from different domains, the following error occurs:

Blocked loading resource from url not allowed by $sceDelegate policy

Solution:

Copy code The code is as follows:

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

A very simple method solves the problem of using iframe across domains in angularjs. I hope you all like it

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn