Use XMLHttpRequest if available, even if not in browser
check availability of document.location and getElementsByTagName