Solution to Error: [$sce:insecurl] Blocked loading resource from url not allowed by $sceDelegate policy.

Error: [$sce:insecurl] Blocked loading resource from url not allowed by $sceDelegate policy.

UPDATE: This error was also appearing in IE11 because of a bug in the user agent detection. That has been fixed in 1.2.0RC2. http://code.angularjs.org/1.2.0-rc.2/

You might see this error when you try to bind an external resource, such as vimeo, youtube, etc. This is a new security measure in 1.2.0. To resolve just add the following line to your AngularJS configProvider.

$sceDelegateProvider.resourceUrlWhitelist(['^(?:http(?:s)?:\/\/)?(?:[^\.]+\.)?\(vimeo|youtube)\.com(/.*)?$', 'self']);

This says that vimeo, youtube and self (aka localhost) are okay to make outbound calls from AngularJS.

Share