Results 1 to 2 of 2

Thread: Can't get user IP on Internet Explorer

Hybrid View

  1. #1
    Join Date
    Apr 2011
    Location
    Brazil/Sao Paulo
    Posts
    21
    Rep Power
    4

    Default Can't get user IP on Internet Explorer

    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.

    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!";
    		}
    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:

    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;		
    
    };
    I also put it on my allowdomains:

    Code:
    <zimletConfig name="zimletname" version="0.1">
    <global>
    <property name="allowedDomains">myIPSite/showIP.php</property>
    </global>
    </zimletConfig>
    Can someone give me some insight here?

  2. #2
    Join Date
    Apr 2011
    Location
    Brazil/Sao Paulo
    Posts
    21
    Rep Power
    4

    Default

    Also, anyone knows if is possible to get the CoS name from each user using a Zimlet? This have something to do with request priority

Similar Threads

  1. app.setView and Internet Explorer...
    By csaguiar in forum Zimlets
    Replies: 0
    Last Post: 03-30-2010, 02:39 PM
  2. Internet Explorer Won't Log In
    By Chewie71 in forum Administrators
    Replies: 6
    Last Post: 04-28-2008, 03:27 PM
  3. Internet Explorer 6
    By roastpork in forum Users
    Replies: 8
    Last Post: 03-23-2007, 02:11 PM
  4. Problem with Internet Explorer 6
    By fimcom75 in forum Users
    Replies: 11
    Last Post: 11-14-2006, 06:44 AM
  5. Internet Explorer 6 with Zimbra UI
    By sebpayne in forum Administrators
    Replies: 11
    Last Post: 02-28-2006, 02:23 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •