Open custom links in the same window without creating nested frames

If you use custom links regularly, you know about this issue. It’s an issue when you decide to open custom links in the existing window rather than a popup window. You can get nested frames where the entire application is within the frame where the data should reside like in the screen shot below. For this screen shot, I had a custom link from the Account Page Layout to a specific report. I chose to Open in Salesforce window without sidebar.


If I run the custom link 3 times in a row, my screen now looks like this.


You get the idea.

Because of this issue, many people opt for using pop-up windows instead. This can be somewhat annoying to an end user, though. We have pop-up blockers now because people don’t like this. Why open another window? You can fix this problem, by using a simple S-Control for your custom link rather than using a direct URL. All you need to do is copy the code below. Where it says {URL GOES HERE}, replace that with the same URL you put in your Custom Link.

< script language="JavaScript">

function redirect()
parent.frames.location.replace(“{URL GOES HERE}”);


< /script >

Note: In order for the code to appear on this blog post I had to add a space in the < script> and < /script> tags. You’ll need to remove those spaces too.

Combine this trick with my old post about Auto-creating reports from web links to do some dynamic reporting right from record (e.g. run an Activity History report for a specific account right from the Account page).


  1. Ian H Said,

    May 13, 2006 @ 1:33 pm

    Here’s another way to get a similar result more easily… just add isdtp=mn to the end of you URL


  2. Scott Hemmeter Said,

    May 13, 2006 @ 6:44 pm

    Ian, I tested your idea and it worked. If you use isdtp=mn as the first parameter, then it’s ?isdtp=mn. Anything after that must be &isdtp=mn.

    What does that parameter actually mean? How do the values translate?

  3. lee byrne Said,

    May 25, 2006 @ 9:30 am

    Scott – I get a SFDC error when I try your code – here’s what it looks like:

    function redirect()


    I’m no java guy – did I mess this up?

  4. Scott Hemmeter Said,

    May 26, 2006 @ 12:06 am

    Lee – remove the { and } that surround your URL.

  5. Kevin Laurence Said,

    June 23, 2006 @ 9:06 am

    Salesforce has published a “solution” on this topic titled:

    Opening a Custom Link in the parent frame created a double strip of tabs?

    But there is an error in their javascript. They are missing the final semicolon on what is your fourth line (“parent.frames.location.replace…”).

    I couldn’t get their code to work in Firefox. Yours worked.

  6. Alex S. Said,

    April 17, 2008 @ 7:14 pm

    I got an “Illegal character” error in Firefox. We fixed it by replacing the double quotes around the URL with single quotes.

  7. Activities Tab in Salesforce | X-Squared On-Demand Said,

    August 5, 2008 @ 9:36 am

    […] Scott Hemmeter blogged about this a while back and included some javascript to get around the double-tabs […]

RSS feed for comments on this post