PDA

View Full Version : Scrolling iFrame not working in Chrome. Help?



senraven
07-30-2010, 02:42 AM
1) Script Title: Scrollable iFrame

2) Script URL (on DD):
http://dynamicdrive.com/dynamicindex17/iframescroll.htm

3) Describe problem:
Ok, so I'm using the scrollable iframe code and it's working fine in Firefox and IE, but the scroll is completely dead in Chrome.

Any ideas? any workarounds? any help? I can extend the entire page or change the code to allow a scroll bar but that just defeats the purpose of having a gorgeous iframe.

jscheuer1
07-30-2010, 04:21 AM
The demo page here on DD:

http://dynamicdrive.com/dynamicindex17/iframescroll.htm

works fine in Chrome for me. How about you?

If so, it's probably something to do with your implementation. If not, it probably has to do with browser settings in Chrome.

If it's the implementation, one thing that folks sometimes get tripped up on is using a valid HTML page inside the iframe.

If you look in the demo's source code for this page in the iframe you will see:


<b>What's Hot</b></p>
<p align="left"><strong><font face="Verdana"><small><a href="http://www.dynamicdrive.com/dynamicindex9/encrypter.htm" target="_top">Source
code encrypter</a>&nbsp;</small></font></strong><br>
<font face="Verdana" size="2">Scramble the source of any chunk of code using
this unique script.</font></p>
<p align="left"><strong><font face="Verdana"><small><a href="http://www.dynamicdrive.com/dynamicindex5/flashlink.htm" target="_top">Flashing
links</a>&nbsp;</small></font></strong><br>
<font face="Verdana"><small>Bring attention to special links, by making them
flash!</small></font></p>
<p align="left"><small><strong><font face="Verdana"><a href="http://www.dynamicdrive.com/dynamicindex13/roamcursor.htm" target="_top">Roaming
Cursor</a>&nbsp;</font></strong></small><br>
<small><font face="Verdana">Display a second, &quot;roaming&quot; cursor on your
page with this fun animation script.</font></small></p>
<p align="left"><font face="Verdana"><strong><a href="http://www.dynamicdrive.com/dynamicindex11/animatedtitle.htm" target="_top"><small>Animated
Document title</small></a><br>
</strong><small>Animate into view your document's title!</small></font>


<!--DO NOT REMOVE BELOW SCRIPT. IT SHOULD ALWAYS APPEAR AT THE VERY END OF YOUR CONTENT-->

<script language="JavaScript1.2">

//Scrollable content III- By http://www.dynamicdrive.com

var speed, currentpos=curpos1=0,alt=1,curpos2=-1

function initialize(){
if (window.parent.scrollspeed!=0){
speed=window.parent.scrollspeed
scrollwindow()
}
}

function scrollwindow(){
temp=(document.all)? document.body.scrollTop : window.pageYOffset
alt=(alt==0)? 1 : 0
if (alt==0)
curpos1=temp
else
curpos2=temp

window.scrollBy(0,speed)
}

setInterval("initialize()",10)

</script>

Notice no DOCTYPE, head, meta or body tags. It only contains the content and the script. Yours should be similar.

If that doesn't fix it for you:

Please post a link to a page on your site that contains the problematic code so we can check it out.

senraven
07-30-2010, 04:35 AM
John, thank you for the reply.

I did what you said with the inside iframe file but it was still not working. Then after a few choice words I decided to upload the files so i could post the link here as well as check it online, and it works. So I don't know what the deal is, but when checking it in browser just opening from the hard drive the scroll is not working, but once I uploaded it, everything is working fine.

Thanks for taking a shot at helping

jscheuer1
07-30-2010, 03:52 PM
Well, I perhaps should have thought of that. In Chrome there is enhanced local security involving javascript communication between files, including pages that normally are allowed to. On the web, this security is about average - like other browsers. So that's probably what was preventing it from working locally.