+ Start a Discussion
David Yarham - FinancialForceDavid Yarham - FinancialForce 

Hovers (Mini Page Layouts) within an iFrame and link target problem



I am currently implementing a VisualForce page within an iFrame and have outputFields that generate Hover upon rollover.


However these Hovers could have fields with links on them and clicking a link will render the page within the iFrame, is there a way apart from DOM traversing to set some sort of Target on the Hovers so the links will open in possibly the Parent, or a New (Tab/Window)?


Any help is much appreciated.



Vincent IpVincent Ip

in a normal html page, you could include the following piece of HTML code in the header



<base target="_top"/>


This will make all links in the iframe behave as if they had target="_top", which loads the link into the top parent frame.



Simply including this code in the VF page will get firefox (and I think Crome) to work, but IE won't like it as it must show up in the <head> section of the HTML for IE to accept it.  



To force this code it into the header of the VF page, create a static resource and include this script in the resource.


document.write('<base target="_top"/>');


and then in your VF page include the resource in an <apex:includeScript ... /> statement.



David Yarham - FinancialForceDavid Yarham - FinancialForce

Will give that a go, thanks....


My only concern is the NavigateToUrl that Salesforce use on the buttons at the top of the MiniPageLayout popup. But ill give it a go


Thanks again.

Vincent IpVincent Ip

Ahh..  yeah...  Good Point!  You're right to have concerns about those navigateToUrl calls (which show up for the View and Edit buttons on the Mini page layout).


For that..  you can override the SFDC behavior by including a script in your VF page..  something like:



function navigateToUrl(url){
    top.window.location = url;






@David Yarham


Were you able to get it working? if so could you please share how, I am having similar issues...

Valerijs ProkudinsValerijs Prokudins
Vincent, you made my day! Thanks a lot!