Hey guys!
I have a huge problem this time. We receive reports of problems from our users, and to identify the user problem we collect some information like: Operation System, Browser and IP. Well, my zimlet works very well on Firefox/Chrome/Safari, but Internet Explorer are giving me headaches. :(
I did some research, and sadly, discovered that IE8/9 have some issues with processing external pages (to prevent XSS). A alternative was to use XDomainRequest(), but you need to configure your site to support it, but also, that dont worked to me.
Right now I trying to use ProxyServlet, but now I got as result "undefined". Here the code:
I also put it on my allowdomains:
Can someone give me some insight here?
I have a huge problem this time. We receive reports of problems from our users, and to identify the user problem we collect some information like: Operation System, Browser and IP. Well, my zimlet works very well on Firefox/Chrome/Safari, but Internet Explorer are giving me headaches. :(
Code:
if (window.XMLHttpRequest) xmlhttp = new XMLHttpRequest();
else xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
xmlhttp.open("GET","http://api.hostip.info/get_html.php",false);
xmlhttp.send();
hostipInfo = xmlhttp.responseText.split("\n");
for (i=0; hostipInfo.length >= i; i++) {
ipAddress = hostipInfo[i].split(":");
if ( ipAddress[0] == "IP" ) return (ipAddress[1]);
}
return "Error!";
}
Right now I trying to use ProxyServlet, but now I got as result "undefined". Here the code:
Code:
/**
* Performs a "GET" against an external server using the Proxy Servlet.
*
*/
uspSuporte.prototype._getIP2 =
function() {
var extServer = "myIPSite/showIP.php";
// url encode the external server url
// since it will part of the query params for the proxy servet
var encodedExtServerUrl = AjxStringUtil.urlComponentEncode(extServer);
// create proxy servlet URL
var proxyServletUrl = [ZmZimletBase.PROXY, encodedExtServerUrl].join("");
// submit the URL and asynchronous response (using callback)
AjxRpc.invoke(null, proxyServletUrl, null, new AjxCallback(this, this._responseIP), false);
};
/**
* Handles the callback from the external http GET AjxRpc.invoke().
*
*
* @see com_zimbra_example_httpgetpost_HandlerObject._executeExternalHttpGet
*/
uspSuporte.prototype._responseIP =
function(response) {
if (response.success == false) {
// display the error response
return "Error";
}
// display the response
return response.text;
};
Code:
<zimletConfig name="zimletname" version="0.1">
<global>
<property name="allowedDomains">myIPSite/showIP.php</property>
</global>
</zimletConfig>