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
vivek somani 1vivek somani 1 

Redirect To vf page on mobile card click ?

In salesforce1, on mobile card click it opens the same vf page in full mode.
But if i want to open some other vf page on mobile card click is there any way to do this ??
Can i do this using javascript somehow ??
bob_buzzardbob_buzzard
No, unfortunately there's nothing you can do about this - the iframe is covered by a link that takes you to the VF page and your mobile card can't push itself in front of this.
kgilkgil
Although bob_buzzard is absolutely right about the iframe being masked, I have been using the following technique which works for my needs.

I have a "preview" Vf page defined to be displayed as the Mobile Card and set it to a 100px height from the Page Layout. This contains just an icon and some preview text in my case. At the bottom of this preview page I have some JavaScript checking the window height. If the window is greater than the 100px I defined for the Mobile Card, then I redirect to my second Vf page containing my intended functionality.

When you first swipe to view the Mobile Card this JavaScript does nothing because it's confined to the 100px height. When you click on the prevew it will open the page in full screen and then automatically redirect to the second page since the height is now greater than 100px. This results in a quick flash of the preview page, but this is acceptable for me instead of needing to do a second click for navigation. 

So at the bottom of my preview page I used the following:

<script>
    function checkSize() {
        var myHeight = 0;
       
        if( typeof(window.innerHeight) == 'number'  ) {
            myHeight = window.innerHeight;
        }
       
        if( myHeight > 100 ) {
            sforce.one.navigateToURL('/apex/someValidPageName');
        }
    }
    checkSize();
</script>

I appreciate any input on the pros/cons of this method, but so far I have been using it without an issue. 

Davide MolinariDavide Molinari
Hi,
I'll try to use your workaround.
@bob any news about this topic?

Davide