Use GWS In JavaScript

The code below shows how the GPlates Web Service can be used in JavaScript.

You might also want to check out the experimental project gplates-js.

var url = 'https://gws.gplates.org/reconstruct/coastlines/?time=50';
var method = "GET"
var xhr = new XMLHttpRequest();
if("withCredentials" in xhr){
xhr.open(method, url, true);
}else if(typeof XDomainRequest != "undefined"){
xhr = new XDomainRequest();
xhr.open(method, url);
}else{
xhr = null;
}
if (!xhr) {
throw new Error('Does your web browser support CORS?');
}
xhr.onload = function() {
var text = xhr.responseText;
console.log(text);
};
xhr.onerror = function() {
alert('something is wrong!');
};
xhr.send();