We help IT Professionals succeed at work.

IFram onload

Sh_Rashed
Sh_Rashed asked
on
Medium Priority
410 Views
Last Modified: 2012-05-06
Hi,

i need to set scrollTo(0,0) each time iframe is loaded. i don't want to use html iframe onload since our cms deleted it. is there any alternative to do that ?
Comment
Watch Question

why not simply define an anchor and add it to the iframe's src URL?

Author

Commented:
umm how would i do this ?
in the page loaded with your iframe you have (somewhere right after the body tag):

<.body><.a name="top">

then you use your iframe like:

<.iframe src="path/to/page.html#top" />

(please remove the . dot)

Standard since 1993 ;-)

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts

Author

Commented:
i have to put this code in every page that will be loaded in the iframe?
coz when i click a link in th iframe and open it in the iframe  the browser scroll doesn't move
> .. when i click a link in th iframe
are you talking about A tags in the loaded page, then it's the responsibility of that link
but if it doesn't have a (anchor)fragment it loads with visibility from top anyway (unless some more or less sophisticated active scripting in there does something different)
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.