I have a button with a JavaScript that 'calls' a php-file. The site is accessible from the internal network and from the world wide web.
If I click the button from www the php is not working because the address in the JavaScript is an internal 192.168.x.x adress.
function doSomething(id)
{
var url ="http://192.168.1.1/phpfile.php?id" +id;
var win = window.open(url, '_blank');
if(win){
//Browser has allowed it to be opened
win.focus();
}
else
{
//Broswer has blocked it
alert('Please allow popups for this site');
}
}
Is it possible to differentiate if the call is from the internal or another network?
In another case (php) I use an if-else to solve the problem
((substr($_SERVER['REMOTE_ADDR'],0,8) == "192.168.") ||($_SERVER['REMOTE_ADDR'] == "127.0.0.1"))
? 'http://internal/address/' : 'http://my.external.de/''