-
-
Save glennyboy/8fdcc2644ef3794206582c9452db3cb4 to your computer and use it in GitHub Desktop.
Cors Anywhere Cross Origin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//CORS Anywhere is a node.js proxy which adds CORS headers to the proxied request. | |
//To use the API, just prefix the URL with the API URL. (Supports https: see github repository) | |
////If you want to automatically enable cross-domain requests when needed, use the following snippet: | |
$.ajaxPrefilter( function (options) { | |
if (options.crossDomain && jQuery.support.cors) { | |
var http = (window.location.protocol === 'http:' ? 'http:' : 'https:'); | |
options.url = http + '//cors-anywhere.herokuapp.com/' + options.url; | |
} | |
}); | |
$.get( | |
// enter your URL below | |
'http://en.wikipedia.org/wiki/Cross-origin_resource_sharing', | |
function (response) { | |
console.log("> ", response); | |
$("#viewer").html(response); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment