js| Access | issues
I built two servers, a database server, a Web server on the intranet. And let network management allude to the network IP to the Web server, so that the external network can be accessed simultaneously. But this creates the problem, the Web server takes the data is uses the intranet the relative address, such extranet accesses when cannot obtain the data, only can display the frame. If the database server also mapped, then the intranet can not access, so I can not debug. If you put two servers together, then the speed of the operation will be affected, and now the boss does not want to invest money, after all, just a demo. And the two machines moved to the laboratory network computer room directly to the outside can also be resolved, but the network room is closed, access control card, so I can not often go in to modify.
Think carefully about it, feel that make a judgment should be able to solve this problem, as long as the decision to access the intranet IP or extranet IP, according to the judgment to carry out the corresponding operation
Check the data found with JS good, because JS access to the IP has an advantage is that it gets the IP set, if the computer through the LAN, then it gets the computer LAN IP, and unlike the ASP request is the computer connected to the Internet IP.
Code (is copied from someone else, but you can refer to the:) )
<HTML>
<meta http-equiv= "Content-type" content=; text/html gb2312
<title>js Get client ip</title>
<body>
<script type= "text/ JavaScript "language=" JavaScript
<!--
function getlocalipaddress ()
{
var obj = null;
var rslt = "";
try
{
obj = new ActiveXObject ("Rcbdyctl.") Setting ");
rslt = obj. getipaddress;
obj = null;
}
catch (E)
{
//exception occurrence
}
return rslt;
}
document.write ("Your IP is:" + getlocalipaddress ());
//-->
</script>
</body>
It is said that the warning may appear in use, but this is only testing, should not be in the way, hehe:)