I came across an error on getting the url meta data by using Angular JS with ajax. The error statement is:XMLHttpRequest cannot load http://www.esample.com/. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access.var app = angular.module('myapp', []); app.controller('ctrl', function ($scope,$http){ $http.get('http://example.in/') .success( function(data,status,headers,config){ var details = [ {title:$(data).filter('title'), description:$(data).filter('meta[name=description]').attr("content"), keywords:$(data).filter('meta[name=keywords]').attr("content"), image:$(data).filter('meta[name=og:image]').attr("content")}, ]; $scope.details; }) .error(function (data, status, headers, config) { $scope.error = " - Something went wrong with your code...."; }); });What I have tried:$http.get('http://example.in/', function (res) { res.header("Access-Control-Allow-Origin", "*"); res.header("Access-Control-Allow-Headers", "X-Requested-With");})...Reference: access to specific domain only. 解决方案 这篇关于如何解决“ access-control-allow-origin" angularjs中的错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 11-03 00:08