Javascript Proxy communication
-
I'm trying to write a simple javascript script that will enable the web page to send commands to my proxy server that I'm developing. However it appears that both Firefox and IE block any attempt to use the XMLHttpRequest object to send web requests. Is there ANY way I can get javascript to send ANY kind of information over the wire that my proxy server can intercept and provide custom services?
-------------------------------- "All that is necessary for the forces of evil to win in the world is for enough good men to do nothing" -- Edmund Burke
-
I'm trying to write a simple javascript script that will enable the web page to send commands to my proxy server that I'm developing. However it appears that both Firefox and IE block any attempt to use the XMLHttpRequest object to send web requests. Is there ANY way I can get javascript to send ANY kind of information over the wire that my proxy server can intercept and provide custom services?
-------------------------------- "All that is necessary for the forces of evil to win in the world is for enough good men to do nothing" -- Edmund Burke
I don't completely understand, are you saying that IE and Firefox aren't letting you make Ajax calls? The XMLHttpRequest does send web requests. In addition what sort of proxy are you using?
Brad Australian By contacting your lawyer you negate the right to sue me.
-
I don't completely understand, are you saying that IE and Firefox aren't letting you make Ajax calls? The XMLHttpRequest does send web requests. In addition what sort of proxy are you using?
Brad Australian By contacting your lawyer you negate the right to sue me.
Hi Brad, I wrote a simple script that calls
open( "GET", url, true );
and the Error Console in Firefox says, "Permission denied to call method XMHttpRequest.open" The proxy is something I'm developing. It's going to be an intercepting proxy. In the code below, thealert( "Request sent" )
never gets called:var xmlhttp;
function loadPage( url )
{
xmlhttp=new XMLHttpRequest();
xmlhttp.onreadystatechange=state_Change;
xmlhttp.open("GET",url,true);
xmlhttp.send(null);
alert( "Request Sent" );
}function state_Change()
{
// if xmlhttp shows "loaded"
alert("State Change" );
if (xmlhttp.readyState==4)
{
// if "OK"
if (xmlhttp.status==200)
{
// ...some code here...
alert( "200 OK!" );
}
else
{
alert("Problem retrieving XML data");
}
}
}-------------------------------- "All that is necessary for the forces of evil to win in the world is for enough good men to do nothing" -- Edmund Burke
-
Hi Brad, I wrote a simple script that calls
open( "GET", url, true );
and the Error Console in Firefox says, "Permission denied to call method XMHttpRequest.open" The proxy is something I'm developing. It's going to be an intercepting proxy. In the code below, thealert( "Request sent" )
never gets called:var xmlhttp;
function loadPage( url )
{
xmlhttp=new XMLHttpRequest();
xmlhttp.onreadystatechange=state_Change;
xmlhttp.open("GET",url,true);
xmlhttp.send(null);
alert( "Request Sent" );
}function state_Change()
{
// if xmlhttp shows "loaded"
alert("State Change" );
if (xmlhttp.readyState==4)
{
// if "OK"
if (xmlhttp.status==200)
{
// ...some code here...
alert( "200 OK!" );
}
else
{
alert("Problem retrieving XML data");
}
}
}-------------------------------- "All that is necessary for the forces of evil to win in the world is for enough good men to do nothing" -- Edmund Burke
-
Can you post all the javascript that relates to the request here?
Brad Australian By contacting your lawyer you negate the right to sue me.
I'm just beginning to learn javascript, so the code I'm trying to use is very simple: ( Thanks for your help ) It says "window.removed" below, but that's something CodeProject did. The real code says "onload"
<!--
function myonload( )
{
loadDoc( "http://www.google.com" );}
window.onload = myonload;
var xmlhttp;function state_Change()
{
// if xmlhttp shows "loaded"
alert("State Change" );
if (xmlhttp.readyState==4)
{
// if "OK"
if (xmlhttp.status==200)
{
// ...some code here...
alert( "200 OK!" );
}
else
{
alert("Problem retrieving XML data");
}
}
}function loadDoc( url )
{
xmlhttp=new XMLHttpRequest();
xmlhttp.removed=state_Change;
xmlhttp.open("GET",url,true);
xmlhttp.send(null);
alert( "Request Sent" );
}//-->
-------------------------------- "All that is necessary for the forces of evil to win in the world is for enough good men to do nothing" -- Edmund Burke
-
I'm just beginning to learn javascript, so the code I'm trying to use is very simple: ( Thanks for your help ) It says "window.removed" below, but that's something CodeProject did. The real code says "onload"
<!--
function myonload( )
{
loadDoc( "http://www.google.com" );}
window.onload = myonload;
var xmlhttp;function state_Change()
{
// if xmlhttp shows "loaded"
alert("State Change" );
if (xmlhttp.readyState==4)
{
// if "OK"
if (xmlhttp.status==200)
{
// ...some code here...
alert( "200 OK!" );
}
else
{
alert("Problem retrieving XML data");
}
}
}function loadDoc( url )
{
xmlhttp=new XMLHttpRequest();
xmlhttp.removed=state_Change;
xmlhttp.open("GET",url,true);
xmlhttp.send(null);
alert( "Request Sent" );
}//-->
-------------------------------- "All that is necessary for the forces of evil to win in the world is for enough good men to do nothing" -- Edmund Burke
My suggestion is to revise the Mozilla tutorial on Ajax. http://developer.mozilla.org/en/docs/AJAX:Getting_Started[^] I am sorry I could not have been of more help, but I can't really see an error with the script.
Brad Australian By contacting your lawyer you negate the right to sue me.
-
My suggestion is to revise the Mozilla tutorial on Ajax. http://developer.mozilla.org/en/docs/AJAX:Getting_Started[^] I am sorry I could not have been of more help, but I can't really see an error with the script.
Brad Australian By contacting your lawyer you negate the right to sue me.
That's OK, thanks for your participation anyway. I will take a look at that link and see if it can provide some clues. :)
-------------------------------- "All that is necessary for the forces of evil to win in the world is for enough good men to do nothing" -- Edmund Burke
-
My suggestion is to revise the Mozilla tutorial on Ajax. http://developer.mozilla.org/en/docs/AJAX:Getting_Started[^] I am sorry I could not have been of more help, but I can't really see an error with the script.
Brad Australian By contacting your lawyer you negate the right to sue me.
Brad, your link DID provide the answer. It turns out that you're not allowed to make requests to domains other than the one that the page belongs to. So because I was requesting Google, it gave the permission denied error. Thanks!
-------------------------------- "All that is necessary for the forces of evil to win in the world is for enough good men to do nothing" -- Edmund Burke
-
Brad, your link DID provide the answer. It turns out that you're not allowed to make requests to domains other than the one that the page belongs to. So because I was requesting Google, it gave the permission denied error. Thanks!
-------------------------------- "All that is necessary for the forces of evil to win in the world is for enough good men to do nothing" -- Edmund Burke
That must be new to FF. No problem btw. Thanks for asking the question, I could have seen myself making the same mistake. BTW a quick hack to get past this is to build PHP/ASP application that will call the requested page, and have that uploaded to ur server.
Brad Australian By contacting your lawyer you negate the right to sue me.
-
Brad, your link DID provide the answer. It turns out that you're not allowed to make requests to domains other than the one that the page belongs to. So because I was requesting Google, it gave the permission denied error. Thanks!
-------------------------------- "All that is necessary for the forces of evil to win in the world is for enough good men to do nothing" -- Edmund Burke
Richie308 wrote:
It turns out that you're not allowed to make requests to domains other than the one that the page belongs to.
Much as it pains me to admit it, apparently ATLAS provides a way around this.
"Now I guess I'll sit back and watch people misinterpret what I just said......" Christian Graus At The Soapbox
-
Brad, your link DID provide the answer. It turns out that you're not allowed to make requests to domains other than the one that the page belongs to. So because I was requesting Google, it gave the permission denied error. Thanks!
-------------------------------- "All that is necessary for the forces of evil to win in the world is for enough good men to do nothing" -- Edmund Burke
Richie308 wrote:
It turns out that you're not allowed to make requests to domains other than the one that the page belongs to.
It would be a huge security hole otherwise. There are ways of getting around this for most browsers, but they require the user to explicitly allow the exception - so, they're more useful for intranet-type development.