function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Susana NTSSusana NTS 

Show report in home page html iframe and scroll it

Hi all,

 

I would like to show, in the home page, a Salesforce custom report, the list of tasks and the calendar. From the report I want to show only its chart or if that's not possible, only the details of the report, that is not displaying the Salesforce header nor the filters section.

 

To achieve this, I have created a HTML component with an iframe and some javascript code lines. The iframe src attribute is the custom report id. This, obviously, works fine. The problem comes when I try to get the iframe window and scroll it right to the chart position.

 

The Home Page component content is:

 

<iframe id="reportVN" src="/00OS0000000d8yQ" width="100%" scrolling="no" frameborder="0" height="350"></iframe><script type="text/javascript"> var marco = parent.document.getElementById("reportVN"); marco.contentWindow.scrollTo(0, 1000);</script>

 

This code does nothing at all.

If I put an alert to see if I can access the iframe by its ID, I get the iframe properly. I tried to change its visibility to see if I was able to change the iframe attributes, and it worked.

So I put the scrollTo() function (the last line in the code sample) inside an alert and all I got was an "undefined" message.

 

Any ideas on this issue??

 

Thanks,

 

Susana 

 

 

 

 

werewolfwerewolf
Have you tried inspecting your code with Firebug, the Firefox addon?  That will help you know what your JS can actually see.  Also, is your home page component perhaps running in a separate domain than the iframe?  If that were the case then its javascript would not be able to to touch the iframe's contentWindow.  Firebug would tell you that too.
Susana NTSSusana NTS

Thanks werewolf, that's exactly what I'm trying but I'm getting lost in all that code and elements from Salesforce :smileysad:

 

I'm sure I will have this solved soon ^^ 

Message Edited by Susana NTS on 12-02-2010 10:07 AM
werewolfwerewolf

The debugger keyword is your friend.  Inside your Javascript code, put the following line:

 

debugger;

 

And firebug will break right there.  Don't forget to take it out when you're done.