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
cooldamselcooldamsel 

VisualForce Components not loading when redirecting in Mobile devices

Hi All,

I am new in Salesforce1 App development. I have created a VisualForce page which contains map, date picker, custom visualforce components and visuaforce remoting methods. I have created a functionality which redirects to another page url using window.location.href. Then i noticed from documentations that window.location will not work in mobile devices. Then on further analysis found that we need to use sforce.one.naviagteToURL and my code is

Redirect : function ()
{
    var url = '/apex/MyCustomPage';
    if( (typeof sforce != 'undefined') && (sforce != null) ) 
    {
          // Salesforce1 navigation
          sforce.one.navigateToURL(url);
    }
    else
    {
          // Set the windows URL
          window.location.href = url;
    }
}


This above code works fine in my desktop version but when i use the same in mobile device, the components like DatePicker, Custom Compoents, map inside MyCustomPage are not loaded in the page when this redirect method is called. Am breaking my heads with this. Anyone please help me out.

Thanks in Advance,
Indhu
sandeep sankhlasandeep sankhla
Hey,

Please refere below code which I haev used and it was working fine for me
 
window.onload = function redirectToDestinationPage()
            { 
                if( (typeof sforce != 'undefined') && (sforce != null) ) {
            
                    sforce.one.navigateToURL('/apex/uniqueLeadSF1Version');
            } 
            else {
                window.location.href = '/apex/uniqueLead';
            }
        }

Please chck and let me know if it helps you

Thanks,
Sandeep
cooldamselcooldamsel
Hi Sandeep,

I have done the same logic in redirecting to page but you have redirected to different versions of the page. And in my scenario, the redirection works fine with the page url but if i include parameters in my url the components in the page are not loading.

Thanks, 
Indhu