Home > Web Front-end > JS Tutorial > body text

Solution to error when opening content in AngularJS iframe across domains_AngularJS

WBOY
Release: 2016-05-16 16:18:10
Original
1307 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:
source:php.cn
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template