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.
If someone has some better solution please share
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');
}
};