Jump to content

In a Web Application and Mobile (hybrid), how to know which this platform running?


gustotc

Recommended Posts

Hi

 

You can try this js code to check platform. Add MainForm's Script properties.


  var userAgent = navigator.userAgent || navigator.vendor || window.opera;

  if( userAgent.match( /iPad/i ) || userAgent.match( /iPhone/i ) || userAgent.match( /iPod/i ) )
  {
		//call your css in here for ios

  }
  else if( userAgent.match( /Android/i ) )
  {
	//call your css in here for android
   
  }
  else
  {
   //call your css in here for other
  }
}

But why do you check platform? You can change css rules using media queries in css.

For example

@media screen and (min-width: 480px) {
    body {
        background-color: lightgreen;
    }
}

also you can create an hybrid project. Examine Demos/Touch/Hybrid demo.

 

And you can change layout on clientside. Examine Demos/Desktop/Clientside Alignment - ... demos.

Link to comment
Share on other sites

Hi

 

You can try this js code to check platform. Add MainForm's Script properties.


  var userAgent = navigator.userAgent || navigator.vendor || window.opera;

  if( userAgent.match( /iPad/i ) || userAgent.match( /iPhone/i ) || userAgent.match( /iPod/i ) )
  {
		//call your css in here for ios

  }
  else if( userAgent.match( /Android/i ) )
  {
	//call your css in here for android
   
  }
  else
  {
   //call your css in here for other
  }
}

But why do you check platform? You can change css rules using media queries in css.

For example

@media screen and (min-width: 480px) {
    body {
        background-color: lightgreen;
    }
}

also you can create an hybrid project. Examine Demos/Touch/Hybrid demo.

 

And you can change layout on clientside. Examine Demos/Desktop/Clientside Alignment - ... demos.

 

 

Thanks

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...