Take the 2-minute tour ×
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.

I'm embedding a dashboard in a visualforce page using an iframe:

<iframe src="/01ZJ00000007JGa?isdtp=vw"/>

When I try to click on any component to load the underlying report, I get this javascript error:

Uncaught TypeError: Cannot read property 'Listener' of undefined   iframeinterface.js:1
Sfdc.xdomain.IframeInterface.handleOnload                          iframeinterface.js:1
window.onload                                                      crossDomainProxy.html:6

The affected file is served from <SFHOST>/xdomain/iframeinterface.js and the specific line that's causing the error is:

("sfdc-console" === b ? top : 
    "undefined" !== typeof a.targetParentFrame ? 
         parent.frames[a.targetParentFrame].frames[b] : 

Any thoughts about what's going wrong and how I can fix it?


I was able to accomplish what I need to with the following hack described in this answer, made possible by the fact that I'm on the same domain. But I'll leave the question open, looking for a more thorough explanation and non-hackish way to embed a dashboard in Visualforce.

share|improve this question
Is the purpose of isdtp just to strip off the headers and footers of the dash and just expose the dashboard? I tried with lt and mn params it seems to work, with vw (ca-peterson.com/2011/11/magic-isdtp-param.html)I get the same domain error Uncaught TypeError: Cannot read property 'xdomain' of undefined –  rao Feb 21 '13 at 19:12
Interesting... And yes, I'm using isdtp to hide headers since this is embedded. Confirmed that links work with mn (although it's ugly) –  Benj Feb 21 '13 at 19:20
Update: seems like the problem happens in the srcUp method. It only happens when clicking on chart images, not on table components –  Benj Feb 21 '13 at 19:35
Why bother building a Visual Force page when you can just use this code directly in an HTML Area Home Page component? < iframe src="/000000000000000?isdtp=vw" frameborder="0" height="768" width="1024"></iframe> The 000000000000000 is your Dashboard page ID. It displays the Dashboard seamlessly. But, I face the same problem you're all talking about, which is that the links don't work. Is there an HTML solution rather than Apex? –  Jim Minichiello Jun 17 '13 at 20:03
@Jim, because I don't want it on my homepage - I want it embedded in another page. But yes, the solution accepted as an answer below uses Javascript (not Apex) to solve the broken links issue. –  Benj Jun 18 '13 at 0:06

3 Answers 3

up vote 5 down vote accepted

Loading the Dashboard with isdtp removes the header and sidebar, but isn't officially supported. When you do this, SFDC replaces all the links with a call to the srcUp() function, which doesn't work in this context.

To get around that, add the following script to your VF page to change the links back:


jQuery( function ($) {

     $('#iframeID').load( function() {              
         var $frameDoc = this.contentWindow.document,
             urlMatch = /srcUp\(%27(.*)%27\)/;

         $('a[href*="srcUp"]', $frameDoc).each( function () {
             this.href = decodeURIComponent(this.href.match(urlMatch)[1]);


<!-- the rest of your page goes here -->

<iframe id="iframeID" src="/01ZJ00000007JGa?isdtp=vw"/>

share|improve this answer
I tried the code mentioned above but I got this error in the console "Uncaught ReferenceError: jQuery is not defined". am I missing something? <apex:page> <script> jQuery( function ($) { $('#iframeID').load( function() { var $frameDoc = this.contentWindow.document, urlMatch = /srcUp\(%27(.*)%27\)/; $('a[href*="srcUp"]', $frameDoc).each( function () { this.href = decodeURIComponent(this.href.match(urlMatch)[1]); }); }); }); </script> <!-- the rest of your page goes here --> <iframe id="iframeID" src="/01ZJ00000007JGa?isdtp=vw"/> –  user2824 May 10 '13 at 3:26
Yup. You'll need to have jQuery loaded on your page. Easiest way is to add <script src="http://code.jquery.com/jquery-1.9.1.min.js"></script> to the top of your visualforce page. –  Benj May 12 '13 at 3:17
This doesn't seem to work anymore, salesforce blocks the script from reaching the other domain. –  DashboardReport Oct 28 '14 at 19:10

When I have run across this problem, I ended up re-creating the charts I needed using the analytics:chart tag on a Visualforce page. Not the same as embedding, but it is fully supported. It does mean more maintenance as any changes to the dashboard have to be manually updated. In my particular use case it worked well for them but YMMV.

share|improve this answer

With Spring 15 release, iFrame is not supported by Salesforce anymore. So we need to have an alternative way to achieve this functionality.

share|improve this answer
(1) what do you mean that iframe is no longer supported by Salesforce? This question is about embedding dashboards in Visualforce, and AFAIK there are no limitations on including iframes in a VF page.... (2) This isn't really an answer, so please changing it to a comment on the question or another answer. –  Benj Apr 17 at 13:42
If you have a new question, please ask it by clicking the Ask Question button. Include a link to this question if it helps provide context. –  Chris Duncombe Apr 17 at 14:38
This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post - you can always comment on your own posts, and once you have sufficient reputation you will be able to comment on any post. –  Mohith Shrivastava Apr 17 at 15:55
Please refer for link below: success.salesforce.com/issues_view?id=a1p300000008XttAAE –  monika verma Apr 21 at 12:21

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.