Custom Widget on portals Accessing external URL


I Want to compare some of the data that I am uploading to portals, to some external data.
for example from this URL:

I am having trouble pulling data from that site but not this one:

Here is my custom code:

var request = new XMLHttpRequest();‘GET’, ‘’, false);
request.onload = function () {
if (request.status >= 200 && request.status < 400) {
} else {


Any help is appreciated.




Hey Josh,

I know we covered this in a private support thread but I want to recap here what we found in case it is helpful for other users in the future:

We found that hitting the desired external API was failing because the API does not support a secure connection - connections out from a custom Portals widget must be secure. The workaround you implemented was to create a simple web server that acts as a secure proxy to the data and can be connected to from your widget.


Hi Eli,

Yes, I was able to get this to work using as a work around!

function( container, portal )
var data;
var cors_api_url = ‘’;
function doCORSRequest(options, printResult) {
var x = new XMLHttpRequest();, cors_api_url + options.url);
x.onload = x.onerror = function() {
(x.responseText || ‘’)
if (/^POST/i.test(options.method)) {
x.setRequestHeader(‘Content-Type’, ‘application/x-www-form-urlencoded’);
// Bind event

    method: = 'GET',
    url: '',
    data: ''
  }, function printResult(result) {

function displayMessage( message )
var h3 = document.createElement(‘h3’),
p = document.createElement(‘p’)

container.appendChild( h3 );
container.appendChild( p );
p.innerHTML = message; = '5px'; = '#42b0f4';