S1 Mobile Card, navigateToUrl issue

I can’t navigate to a visualforce page from a mobile card, on click any of these links it opens the same mobile card page in full size. here is simplified source of the page used as mobile card:

<apex:page standardController="Contact" showHeader="false" standardStylesheets="false" sidebar="false">
    <a target="_parent/_top/tried all of them" href="{!URLFOR($Page.SomeVFPage)}">Href link</a>
    <br/>
    <a href="#" onclick="sforce.one.navigateToURL('{!URLFOR($Page.SomeVFPage)}')">S1 navigateToURL full</a>
    <br/>
    <a href="#" onclick="sforce.one.navigateToURL('/apex/SomeVFPage')">S1 navigateToURL partial</a>
    <br/>

Answer

This is because the <article> element that contains the Visualforce card has an onclick handler for the entire card that takes you to the full size card. You may be able to workaround this by stopping the event propagation if your handler is called prior to the article element’s handler.

You can read more about event propagation and how to stop it for modern browsers at:

https://developer.mozilla.org/en-US/docs/Web/API/Document_Object_Model/Examples#Example_5:_Event_Propagation

Attribution
Source : Link , Question Author : Abhinav Gupta , Answer Author : Bob Buzzard

Leave a Comment