
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:
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
Hmmm...Let us try overriding the native navigateToUrl
method like as below(replace the previousscript
tag entirely with thescript
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>