473,385 Members | 1,829 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Why does window.scrollBy() not work for window.open()?

1
Hi,

I am a new html developer. I write an html script program to view a specific web site for a given URL. After a web page is loaded into the application view, i then use a scrollBy() function to automatically scroll the content of the web page. The scrollBy() function does not work after i open the URL in my application?

Here is my sample code, if somone can tell me what wrong with my sample program? Here is my html file:

-------------------------
Expand|Select|Wrap|Line Numbers
  1. <html> <head> <title>
  2.         Web page auto scroll Test
  3.     </title> </head> <script type="text/javascript"> 
  4.     function pageScroll() 
  5.     {    
  6.         window.scrollBy(0,1);   
  7.         scrolldelay = setTimeout('pageScrol()',20);     
  8.     }
  9. </script> <body style='background-color:#FFFFFF' onload="startTime()"> <script type="text/javascript">
  10.         var ContextWindow = window.open("http://search.yahoo.com/search?ei=utf-8&fr=slv8-i3752&p=scrolling%20issue&type=",
  11. '_main','width=100%,height=92%, position=bottom, resizable=0,scrollbars=auto,toolbar=0,status=0');
  12. pageScroll();
  13. </script> </body> </html>
Oct 5 '12 #1
1 3900
gits
5,390 Expert Mod 4TB
in your onload you call:
Expand|Select|Wrap|Line Numbers
  1. onload="startTime()
but your function's name is:
Expand|Select|Wrap|Line Numbers
  1. pageScroll
the script that you call with the script tags in the body is useless in this case since it is called during parse-time of the page - not when it's loaded and ready.

and if you want to scroll the page in the opened window - then its impossible at all - since this page is obviously from another domain and you cannot access that with javascript due to security reasons - because this would be cross-site-scripting, which is considered as an attack, so browsers will not allow it. look here for it: https://developer.mozilla.org/en-US/...for_JavaScript
Oct 8 '12 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

10
by: Marshall Dudley | last post by:
When I do the following line in Netscape, the popup loads as it should, but the parent window usually, but not always, reloads as well. <a href="#"...
4
by: Davey | last post by:
I have a website which has a popup window (this only opens when the user chooses to open it). In the popup window I have a <select> control which lists a selection of "classes". Each class has a...
2
by: Raj | last post by:
Hi All, I have a problem with trying to refresh the parent window from child window in order to update data in the parent window. The sequence of events are 1) I click a button in the parent...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.