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

Solution to error when opening content in AngularJS iframe across domains_AngularJS

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-05-16 16:18:10
Original
1382 people have browsed it

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

Related labels:
Statement of this Website
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
Latest Issues
angular.js - angularJS ng-style用法
From 1970-01-01 08:00:00
0
0
0
angular.js - AngularJS form validation
From 1970-01-01 08:00:00
0
0
0
angular.js - Learning AngularJS
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template