• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 402
  • Last Modified:

IFram onload

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 ?
0
Sh_Rashed
Asked:
Sh_Rashed
  • 3
  • 2
1 Solution
 
ahoffmannCommented:
why not simply define an anchor and add it to the iframe's src URL?
0
 
Sh_RashedAuthor Commented:
umm how would i do this ?
0
 
ahoffmannCommented:
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 ;-)
0
 
Sh_RashedAuthor 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
0
 
ahoffmannCommented:
> .. 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)
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now