I have a current webpage that utilizes a piece of javascript to execute the following:
function initiateAction(parameter) {
request = false;
if (window.XMLHttpRequest) {
try {
request = new XMLHttpRequest();
} catch (error) {
request = false;
}
} else if (window.ActiveXObject) {
try {
request = new ActiveXObject("Msxml2.XMLHTTP");
} catch (error) {
try {
request = new ActiveXObject("Microsoft.XMLHTTP");
} catch (error) {
request = false;
}
}
}
if (request) {
var url_string = "/Servlet?parameter=" + parameter;
request.open("GET", url_string, false);
request.onreadystatechange = handleRequestChange;
request.send(null);
// process the response
}
return something;
}
My concern is that if someone manually enters the full URL into their browser window (e.g. "") the response is displayed. How can I prevent this and only allow the code to access the response?