Trying to get check if a URL is reachable (actually able to be loaded from a browser) in GWT. The problem is that I'm getting an error because of the requested domain (same origin policy) with this code:
RequestBuilder checkRequest = new RequestBuilder(RequestBuilder.HEAD, urlString);
checkRequest.setCallback(new RequestCallback(){
@Override
public void onResponseReceived(Request request, Response response) {
if (response.getStatusCode() > 199 && response.getStatusCode() < 300)
Window.open(urlString, "", "");
}
@Override
public void onError(Request request, Throwable exception) {
// Handle error
}
});*/
Since urlString could be any URL, I need to check whether it's actually valid or not before navigating to it. Is there another way to go about doing this in GWT (that works for IE, Chrome, and Firefox)