Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Javscripting

  • 03-04-2000 10:04pm
    #1
    Registered Users, Registered Users 2 Posts: 1,278 ✭✭✭


    Can Any Javscripting Guru tell me the code to display the user's IP address and hostname, such as at the following address.
    http://kid.pagecount.com/kid/tellip/
    (I've tried viewing the source of the above page, but the script is hidden).
    Also the script should be NS and IE compatible!

    Slán,
    jAH

    [This message has been edited by jArgHA (edited 03-04-2000).]


Comments

  • Closed Accounts Posts: 7,488 ✭✭✭SantaHoe


    Well, I don't know the exact form, but here's a sample html that'll do just that.
    <html>
    <head>
    <title>IP info</title>
    
    <!--   REQUIRED BY GGScript   -->
      <script language="JavaScript"> var GG_js = 1.0; </script>
      <script language="JavaScript1.1"> var GG_js = 1.1; </script>
      <script language="JavaScript1.2"> var GG_js = 1.2; </script>
      <script>
       <!--   REQUIRED BY GGScript   -->
        var GG_sk = "Unknown";var GG_cd = 0;var GG_sw = 0;var GG_sh = 0;var GG_dr = GG_sk;var GG_du = GG_sk;var GG_an = GG_sk;var GG_av = GG_sk;var GG_np = GG_sk;var GG_ua = GG_sk;var GG_IPAddr = GG_sk;
        document.URL?GG_du=document.URL:GG_du=GG_sk;document.referrer?GG_dr=document.referrer:GG_dr=GG_sk;navigator.appName?GG_an=navigator.appName:GG_an=GG_sk;navigator.appVersion?GG_av=n avigator.appVersion:GG_av=GG_sk;navigator.userAgent?GG_ua=navigator.userAgent:GG_ua=GG_sk;
        if(GG_js >= 1.2)
        {
         if(screen.width)GG_sw=screen.width;if(screen.height)GG_sh=screen.height;if(screen.colorDepth)GG_cd=screen.colorDepth;
         GG_cd==2?GG_cd="4":(GG_cd==4?GG_cd="16":(GG_cd==8?GG_cd="256":(GG_cd==16?GG_cd="65K":(GG_cd==24?GG_cd="16.7M":(GG_cd==32?GG_cd="16.7M":dd=0)))));
         navigator.platform?GG_np=navigator.platform:GG_np=GG_sk;
        }
        if(GG_js >= 1.1)
         document.write("<script language=\"JavaScript1.1\" src=\"http://www.ggscript.com/GGScript/GG_IP.cgi?"+GG_du+"^"+escape(GG_an)+"^"+escape(GG_ua)+"^"+escape(GG_np)+"^"+GG_sw+"^"+GG_sh+"^"+GG_cd+"^"+escape(GG_dr)+"\"></"+"script >");
        // -->
       </script>
       <script>
        <!--
         // REQUIRED BY GGScript
         // do not remove, Netscape 3 needs this...
          document.write(" ");
        // -->
       </script>
    
    <script>
         if(GG_IPAddr != GG_sk)
          document.write("<B>Your IP address:</B><BR>"+GG_IPAddr+"<BR><BR>")
    
    
       </script>
    
    <SCRIPT LANGUAGE="JavaScript">
    
    function getIP(form)	{
    form.IP.value = GG_IPAddr;				
    }
    
    
    </SCRIPT>
    
    
    </HEAD>	
    <BODY onload="getIP(form)" BGCOLOR="#FFFFFF">
    
    <input type="hidden" name="IP" value="">
      
    </body>
    </html>
    

    The answers to all your JavaScript questions, also thousands of free scripts.
    http://www.javascripts.com


    [This message has been edited by TheTurdBurgular (edited 04-04-2000).]

    [This message has been edited by Dead{o}Santa (edited 04-04-2000).]


Advertisement