Okay. I've made a simple script to demonstrate it. Here's the only JS file:
var xhr;
var ready;
function OnEvent_ChatWndSendMessage(Wnd, Message)
{
if(Message.substr(0, 10) != "/ajax-test")
return "";
Debug.Trace("Retrieving " + Message.substr(11));
var Iter = 0;
xhr = new ActiveXObject("Microsoft.XMLHTTP");
xhr.open("GET", encodeURI(Message.substr(11)), true);
xhr.onreadystatechange = function()
{
if(xhr.readyState == 4)
ready = true;
};
ready = false;
xhr.send();
while(!ready)
// If I don't check for this here, it just hangs up because ready is always false and this becomes an infinite loop
if(Iter++ > 10000000)
{
Debug.Trace("Error.");
return "";
}
Debug.Trace(xhr.responseText);
return "";
}
With the appropriate ScriptInfo.xml, I've tested it with several URLs, and here are the results:
Function called: OnEvent_ChatWndSendMessage
Retrieving
http://example.com/
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
<META http-equiv="Content-Type" content="text/html; charset=utf-8">
<TITLE>Example Web Page</TITLE>
</HEAD>
<body>
<p>You have reached this web page by typing "example.com",
"example.net","example.org"
or "example.edu" into your web browser.</p>
<p>These domain names are reserved for use in documentation and are not available
for registration. See <a href="http://www.rfc-editor.org/rfc/rfc2606.txt">RFC
2606</a>, Section 3.</p>
</BODY>
</HTML>
Function called: OnEvent_ChatWndSendMessage
Retrieving
http://www.example.com/
Error.
Function called: OnEvent_ChatWndSendMessage
Retrieving
http://www.msgplus.net/
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="norton-safeweb-site-verification"
...
</div>
</body>
</html>
Function called: OnEvent_ChatWndSendMessage
Retrieving
http://www.google.com/
Error.