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
JfostJfost 

How to get URL Parameters into Apex Controller from Visualforce Page embedded in Community Page.

The following works in desktop, but not mobile:

System.debug(ApexPages.currentPage().getHeaders().get('referer'));

'referer' is not available on when using a mobile device...

I know I'm on a mobile device if the following is true:

Boolean isMobile = UserInfo.getUiTheme() == 'Theme4t';

How do I get the URL parameters in my Apex Class when the VF Page loads in Community Page... ?

Thank you!

SwethaSwetha (Salesforce Developers) 
HI Jfost,
What is the mobile device you are using? I have come across a similar scenario in the past. Check https://salesforce.stackexchange.com/questions/327440/browser-not-detecting-ipad-and-showing-as-desktop/327467#327467 

If this information helps, please mark the answer best. Thank you
JfostJfost
Thank you for your response. Your link looks like it's geared towards an aura component? I'm just looking to get a url parameter into apex controller from a vf page embedded on a community page. Mobile device I'm using is iPhone iOS. I have also tested on android though Galaxy. 
Ashish Kumar YadavAshish Kumar Yadav
HI Jfost,

You need to do like that pass the id from vf page to url and get in apex class . 
public String addTo{get;set;}
addTo= Apexpages.currentPage().getParameters().get('addTo');

if it is work for please mark as the best answer.
JfostJfost
Thank you for your response. Please further investigate that your solution works on MOBILE devices. That actually doesn’t even work for desktop.. your method does work for test classes though.. but I’m getting the URL parameter with the following: System.debug(ApexPages.currentPage().getHeaders().get('referer'));. This works on desktop just fine, but it seems the header parameter called ‘referer’ is not available for mobile devices. How do I get the URL parameters in my Apex Class when the VF Page loads in Community Page on a MOBILE device… ? -Justin Foster