Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

heroku proxy cross origin

(function() {
var cors_api_host = 'cors-anywhere.herokuapp.com';
var cors_api_url = 'https://' + cors_api_host + '/';
var slice = [].slice;
var origin = window.location.protocol + '//' + window.location.host;
var open = XMLHttpRequest.prototype.open;
XMLHttpRequest.prototype.open = function() {
    var args = slice.call(arguments);
    var targetOrigin = /^https?://([^/]+)/i.exec(args[1]);
    if (targetOrigin && targetOrigin[0].toLowerCase() !== origin &&
        targetOrigin[1] !== cors_api_host) {
        args[1] = cors_api_url + args[1];
    }
    return open.apply(this, args);
};
})();
Comment

PREVIOUS NEXT
Code Example
Javascript :: how to delete current clicked item in array react 
Javascript :: javascript ean13 checksum generate 
Javascript :: append a method to an already existing class in javascript 
Javascript :: Nextjs mongodb connection setup 
Javascript :: math.random 
Javascript :: add pdf in react app 
Javascript :: npm jwt decode 
Javascript :: javascript function call with variable 
Javascript :: service worker self.clients 
Javascript :: axios httsagent 
Javascript :: run another process on nodejs process exit 
Javascript :: Get Country from the international phone number 
Javascript :: custom hook 
Javascript :: import bootstrap 4 in react 
Javascript :: Create A Promise And Then Return It 
Javascript :: get response from window.open 
Javascript :: javascript modify href attr 
Javascript :: vuejs pass data to router-view 
Javascript :: reactjs svg SyntaxError: unknown: Namespace tags are not supported by default 
Javascript :: Image preload React 
Javascript :: uncaught type error event listener error 
Javascript :: show filed of object javascript 
Javascript :: javascript detect paste contents 
Javascript :: paginacion javascript 
Javascript :: hide urls in .env in react app 
Javascript :: Invalid prettier configuration file detected. See log for details. 
Javascript :: react event listener 
Javascript :: socket-client-io for reconnection in js or javascript 
Javascript :: javascript .target 
Javascript :: angular-chart.js 
ADD CONTENT
Topic
Content
Source link
Name
4+4 =