function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
gyani19901.3956550919266765E12gyani19901.3956550919266765E12 

i have a vf page on a custom object , and in the vf page i have a custom button so let me know that on click of button how can i recognize that the page is open in system(desktop or laptop) or this is in mobile salesforce 1 app,, so how can i find out

i have a vf page on a custom object , and in the vf page i have a custom button so let me know that on click of button how can i recognize that the page is open in system(desktop or laptop) or this is in mobile salesforce 1 app,, so how can i find out
Kunal BindalKunal Bindal

You can use Javascript for this

if( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ) {
 // mobile specific some code..
}
else{
  // desktop specific some code..
}
gyani19901.3956550919266765E12gyani19901.3956550919266765E12
Hi Kunal Bindal, i just want to check that the page is in salesforce browser(desktop or laptop) or in salesforce 1 app(mobile) after click of button in vf page.
Kunal BindalKunal Bindal

This is a javascript code you can put this in a function and check either before calling your actual function or after completion of your function.

I can explain you this in a better way if you share your code where you want to do this.
 

Kunal BindalKunal Bindal
Or if you just want to change some css you can do that by javascript only by changing class of your elements.
gyani19901.3956550919266765E12gyani19901.3956550919266765E12
Thanks for your answer and this is done.
SFDC@ErrorSFDC@Error
Hi Kunal.I am facing a problem long time. I have a VF page PDF.when i am trying to open in salesforce 1 on android phone its autometically logout salesforce.but its working fine in IOS phone .Can you explain your thought on this issue.