", "upvoteCount": 1, "url": "https://trailhead.salesforce.com/trailblazer-community/feed/0D54S00000A8KYYSA3", "datePublished": "2014-06-01T16:17:28.000Z", "author": { "@type": "Person", "name": "Deepak K Anand", "url": "https://trailblazers.salesforce.com/profileView?u=00530000007r9WpAAI", "affiliation": { "@type": "Organization", "name": "‎‎‎‎‎‎Zoom Communications, Inc." } } }, "suggestedAnswer": [ { "@type": "Answer", "text": "Thank you Deepak, that works well for Links.   However, I forgot to test the \"New Contact\" button that is part of the related list. When I click on that button inside the embedded VF page, it still opens inside the same window. Any thoughts on this?   Thanks again", "upvoteCount": 0, "url": "https://trailhead.salesforce.com/trailblazer-community/feed/0D54S00000A8KYYSA3", "datePublished": "2014-06-01T13:59:39.000Z", "author": { "@type": "Person", "name": "Max Altmark", "url": "https://trailblazers.salesforce.com/profileView?u=0053000000A6eAiAAJ", "affiliation": { "@type": "Organization", "name": "Georgetown University Investment Office" } } } ] } } Skip to main content
Hi SF Success community,

 

I hope everyone is having a good day! I created a custom VisualForce page that uses tabs to display Related Objects. I embedded this custom VF page in the main Accounts record page layout (I renamed Accounts to Firms in my org).

 

The issue I'm having is anytime I click on a link of a Related Object (ex: Contacts) within the embedded VF page, the new page opens within the embedded area. I would like to have all links of the related objects open in the Main Window.

 

Here's a screenshot of how the embedded VF page looks like:

 

How to open all links of an embedded VF page in the main window (vs embedded window)?

 

Is there an APEX code that I can add to the VF page, so all links open in the main window? I wish there was a checkbox in the Edit Layout of the embedded VF option to open links outside the embedded area, but there isn't one.

 

I did some research, but all I keep getting is modifying Controller Extension, and I do not know how to do this. I hope there's a more simple and efficient solutions.

 

Please Help!

 

Thank you
5 件の回答
  1. 2014年6月1日 16:17
    Hmmm...Let us try overriding the native
    navigateToUrl
    method like as below(replace the previous
    script
    tag entirely with the
    script
    given below)

     

    <script type="application/javascript">

    var aTags = document.getElementsByTagName('a');

    for(var i = 0; i < aTags.length; i++)

    aTags[i].target = "_blank";

    function navigateToUrl (a){

    window.top.location.href = a;

    }

    </script>

0/9000