This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Local or Remote connection availability
#1
I am trying to prepare such javascript function which would check if client can connect locally or remotely. I want use this function e.g. for changing image src from local to remote:port.

I thinked that this will be easy but there is a problem with no CORS headline.

Maybe someone has some solution?

At this moment I've prepared such solution for this task:

1. Adding 2 images with classes: '.local'(from LM local address) and '.remote'(from LM remote address)

2. Adding this function to js.
Code:
var local = $('.local > img')[0].naturalHeight > 0;
var remote = $('.remote > img')[0].naturalHeight > 0;
console.log(local, remote)
if (remote){ if(local){
alert('Local');
} else if(!local){
alert('Remote');
}
};
If someone has some better solution please shareWink
Reply


Messages In This Thread
Local or Remote connection availability - by buuuudzik - 28.01.2017, 13:06

Forum Jump: