Illya Stepanov
Posts: 0
Joined: Mon Mar 18, 2013 8:48 am

what is a hybrid app?

Hi Alex -

Yes, in JS you can check if cordova object is available something like this:
pre
code
if (typeof cordova == "undefined") {
//it's html5
} else {
//it's hybrid
}/code
/pre

Alex GG
Posts: 0
Joined: Thu Nov 14, 2013 11:11 pm

what is a hybrid app?

Hi Illya,

Maybe I didnt explain well...

I just need some code to check if the html5 page run on a mobile device, or a desktop browser, in order to switch design and make it responsive....nothing to do with a hybrid app..

I found this link, but not truly understand...

http://stackoverflow.com/questions/80...

Can you help me with that?

Regards

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

what is a hybrid app?

Hi Alex,

You can use following JS code on "page show" event handler :

pre

if (navigator.userAgent.match(/(iPhone|iPod|iPad|Android|BlackBerry|IEMobile)/)) {
//here is code if browser in mobile device
alert("mobile");
} else {
//here is code if browser is desctop.
alert("desctop");
};

/pre

Regards.

Return to “Issues”