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,222
  • 3
  • 61
  • 100
EnexoOnoma
  • 8,021
  • 16
  • 87
  • 172

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,019
  • 44
  • 152
  • 253
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,222
  • 3
  • 61
  • 100
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
  • 75,098
  • 44
  • 181
  • 258
-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,759
  • 15
  • 29