Sharepoint Forum

Ask Question   UnAnswered
Home » Forum » Sharepoint       RSS Feeds

Getting the clients IP address with JavaScript

  Asked By: Stella    Date: Feb 25    Category: Sharepoint    Views: 3523

Half-way there the only thing I am missing is getting the clients IP address
with JavaScript. For some reason I can not get the following to work (I think
that SharePoint does not like it in the master page) it either bombs badly or it
just writes the string literal any ideas???

THESE PLUS MORE HAVE ALL FAILED [partially because some of them aren't even for
asp.net and since I am doing this in SharePoint I need asp.net / JavaScript]

ip = '<!--#echo var="REMOTE_ADDR"-->';

ip = "<?php echo $_SERVER['REMOTE_ADDR']?>";

ip = '<%= Request.ServerVariables("REMOTE_ADDR")%>';

ip = '<%= Request.UserHostAddress>';

ip = '<%=request.getRemoteAddr()%>';

ip = '<cfoutput>#cgi.remote_addr#</cfoutput>';

This script works but everyone gets redirected to https and only one domain is
https not both:

<script type="text/javascript">
function _RedirectToHttps()
if (window.location.protocol == "http:")
var _c_location = window.location.toString();
_c_location = _c_location.substring(4);
window.location = "https" + _c_location;

Also I think this is limited but it was enough to get me this far here is what I
found about javascript redirect/loction:
thought it might be worth mentioning to those like me that don't do much client
side scripting



No Answers Found. Be the First, To Post Answer.

Didn't find what you were looking for? Find more on Getting the clients IP address with JavaScript Or get search suggestion and latest updates.