Saturday, August 21, 2010

If someone navigates within an iFrame, I want the parent page to scroll back to the top. How do I do it?

I have an Amazon aStore integrated into a website using iFrames. How can I program the iFrame such than when someone clicks a link within it, the whole page scrolls back to the top - ie as if you were clicking a link on a normal web page instead of the iFrame? I can't modify the links within the aStore manually.





And is there any simple way of making the iFrame autoresize, given that aStores are on a different domain?If someone navigates within an iFrame, I want the parent page to scroll back to the top. How do I do it?
sounds like you need to add a script to your page.


Try googling for an iFrame autoresize script. Something like this I found:





In the header add this:





%26lt;script language=';JavaScript';%26gt;


function resize() {


var iframe = document.all.iframe_name;


iframe.height=document.frames(';iframe_na鈥?


}


%26lt;/script%26gt;





In the body, you'll need this:





%26lt;body onload=';resize()';%26gt;


or...


%26lt;iframe onload=';resize()';%26gt;





Then add this to the iframe property list:





%26lt;iframe scrolling=';no'; %26gt;%26lt;/iframe%26gt;

No comments:

Post a Comment