[SalesForce] Salesforce1 navigation javascript library

I have a visualforce page that is overridding the Account New button. To make the New button show up in the Salesforce1 app, the page needs to be enabled for movile devices. This page is very complex and we don't want to use it in the Salesforce1 app.

So to try some things out, I created a new vf page to use for redirection. All it basically has in it is javascript to identify if it's in the salesforce1 app or not, then redirect appropriately.

<script>

$(document).ready(function(){
     isMobile();
});


function isMobile(){

    if( (typeof sforce.one != 'undefined') && (sforce.one != null) ) {

        // In Salesforce1, navigate to create account record standard page
        sforce.one.createRecord("Account");    

    }else{
        //navigate to vf page
        window.location.assign("/apex/VFPage");
    }

}
</script>

Within a browser on a non mobile device, it is redirecting to the VFpage as expected. But when in the Salesforce1 app, after clicking New, it shows a blank page (assuming is my vf page for redirection), but after about 20 seconds, it shows a blank white page, then after about 10 more seconds, finally opens the standard create record page.

Has anyone used the navigation sforce.one javascript object like this yet? Is anyone experiencing lagging performance with salesforce1 app? Is there a better way to do this type of redirection?

Thanks!

Best Answer

I have used the sforce object to navigate directly to an account list view using the sforce.navigateToListView method. See my question How to use the sforce.one.navigateToList method?. I did not experience any lag time. I haven't implemented the createRecord, though.

Related Topic