How to check mobile / website in Meteor?

How to check Mobile / Web in HTML Meteor to load user interface ?.

if mobile //here how to check if it is mobile or web { {{>template}}// mobile body } else { {{>template}}//web body } 

I am new to Meteor. So please suggest me what to do?

+6
source share
3 answers

You can easily do this with device-detection .

First install it via:

 meteor add mystor:device-detection 

You can then use the provided helper methods, for example Meteor.Device.isPhone() , or directly from Spacebars: {{#if isPhone}}Phone{{/if}} . See readme on Github for more details.

+8
source

If you just want to check if the application works in a mobile environment, you can use:

 if(Meteor.isCordova) 

Check out other features as well

+4
source

If someone is still looking for this, he can try this JS test:

 if (/Mobi/.test(navigator.userAgent)) { //on Mobile }else{ //not on mobile } 
+1
source

All Articles