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 Salesforce.com 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}”);
}
redirect();
< /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).