iframe question(control the scroll bar)
-
I have a iframe in my page a.html, the iframe points to page b.html, every time when the page loaded completely, the iframe display the top of page b.html My request is to scroll down the iframe so to display the bottom of b.html when page loaded I can invoke below javascript when body.onload event occur: windows.my_frame.scrollTop = 800; it works with b.html which is on the same server with a.html but if the src of the iframe points to the page out of the server(http://www.google.com), the script invoke run time error which means I have no right to set the scrollTop property I can not find and solution or even any explanation on the internet, so came here. Thanks for the help!!!
-
I have a iframe in my page a.html, the iframe points to page b.html, every time when the page loaded completely, the iframe display the top of page b.html My request is to scroll down the iframe so to display the bottom of b.html when page loaded I can invoke below javascript when body.onload event occur: windows.my_frame.scrollTop = 800; it works with b.html which is on the same server with a.html but if the src of the iframe points to the page out of the server(http://www.google.com), the script invoke run time error which means I have no right to set the scrollTop property I can not find and solution or even any explanation on the internet, so came here. Thanks for the help!!!
Please explain where have you placed your script and from where do you call it. Just try to alert something in the script to check if its even called or not.
-
Please explain where have you placed your script and from where do you call it. Just try to alert something in the script to check if its even called or not.
Hi, below is the script function scrollFrame(x, y) { if (window.myFrame&&window.myFrame.scrollBy) { alert("bbb"); var ifr = window.myFrame; ifr.oldPageYOffset = ifr.pageYOffset; ifr.scrollBy(x, y); } } function test() { alert("aaa"); scrollFrame(50, 50); } I call it in the body.onclick() the alert did popup, so means the the function is called but runtime error told me I can not access the property of oldPageYOffset neighter the function scrollBy(x,y) if the frame points url off site
-
I have a iframe in my page a.html, the iframe points to page b.html, every time when the page loaded completely, the iframe display the top of page b.html My request is to scroll down the iframe so to display the bottom of b.html when page loaded I can invoke below javascript when body.onload event occur: windows.my_frame.scrollTop = 800; it works with b.html which is on the same server with a.html but if the src of the iframe points to the page out of the server(http://www.google.com), the script invoke run time error which means I have no right to set the scrollTop property I can not find and solution or even any explanation on the internet, so came here. Thanks for the help!!!
-
You can not do anything at all to a page that is loaded from a different domain. It's a security restriction in the browser.
Despite everything, the person most likely to be fooling you next is yourself.
Yeah, I got the information. But any idea in other ways about how to realize this requirement
-
Yeah, I got the information. But any idea in other ways about how to realize this requirement