I already have a published app in both iOS and Android using Cordova. I'm using PHP scripts to retrieve and send data from server. Both platforms use same PHP script. I send data using XML. And call this script using AJAX.
a sample ajax call :
jQuery.ajax({
url: 'http://www.example.net/example.php', //load data
global: false,
type: "POST",
dataType: "xml",
async: true,
beforeSend: function() {
$('#loading').show();
},
complete: function(){
$('#loading').hide();
},
success: loading_complete_list,
error: errorfunc
});
Problem is I have to send some platform specific data. That means I need to send some specific data for ANDROID. I can't change app code as user may or may not update the app. So I have to change the PHP script such a way that it'll detect the ajax requesting platform or browser and send specific data. So far I know that iOS and Android uses specific webview such as safari or chromium. So if I can at least detect the requesting browser I can detect the platform.
Please remember I can't change app code as it's already published and I can't force user to update. Thus it has to be detected using the PHP script.
I tried searching detect browser using php for ajax call, but no luck so far. Is it possible to detect browser / platform through ajax call in PHP? If so then how?