1

I would like to know how can I scroll down an iframe 100px every 5 secs using maybe javascript. I know that there is a window.scrollTo(x,y); but how does this change to an iframe?

The iframe is an external page.
Any possibility of software to download that does this thing?

Necrolis
  • 25,836
  • 3
  • 63
  • 101
EnexoOnoma
  • 8,454
  • 18
  • 94
  • 179

5 Answers5

1

This isn't possible if you do not have control of the external page's code. browsers prevent this type of thing for security reasons. Its considered cross-domain scripting.

Justin808
  • 20,859
  • 46
  • 160
  • 265
0

Is there an updated version to this method? Not finding it to actually control the content within the http://time.com">

not showing. Thats rather puzzling. So typing iframe inside an iframe makes it go invisible..

0

You can use setInterval to do the scrolling every 5 seconds. the scrolling itsself can be done with this.

Community
  • 1
  • 1
Necrolis
  • 25,836
  • 3
  • 63
  • 101
0

Its very easy using a jquery,

Lets say the id of your iframe is testframe then the code for it would be

$("#testframe").scrollTop(400).scrollLeft(400);

Now just wrap it inside an interval and put it inside.

var tick=1;
function scrolldown(tick) {
    $("#testframe").scrollTop(tick*100);
}
self.setInterval("scrolldown("+(tick+1)+")",5000);

Note: Just a typo

Starx
  • 77,474
  • 47
  • 185
  • 261
-1

If you are building a desktop application (Windows, Linux, not quite sure), I would suggest you to find a component that is the java equivalent of the C# web browser control.

Since this control is loaded in a desktop applicaiton, you have full control over the browser loaded document (e.g. you can manipulate it, without being in a cross domain context).

Pavel Donchev
  • 1,809
  • 1
  • 17
  • 29