• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

IFrame scroll position

 
Ranch Hand
Posts: 214
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This post should perhaps be in the HTML forum, please move it if needed. I was unsure where to best place it.

In a project we use JSP content pages, with the actual content being displayed in an IFrame. Users can scroll down long documents, then click on links that take them to a different page. Now if they click the browsers back button, the original content page is displayed again, but it does not display at the same scroll position as before...forcing the users to scroll down all the way again.

Basically, what I want to do is something like at http://de.selfhtml.org/html/frames/anzeige/iframe.htm where you can scroll down, click a link (that might even leave the frame), then use the browser back button and return to the original page at the same position.

I am not certain what causes our system to work differently. Our JSP works much the same as the example page above, it defines a header area for document info, then the IFrame which pulls its content from our application. The IFrame also uses "scrolling=yes" attribute (which should be the default anyway). Are there any other attributes (in the frame or the page) which might cause trouble?

Else the problem must be in the way the IFrame content is obtained. One thing I noted is that the links in the documents go through a method that displays them in the top frame (I think thats neccessary too, so that the new documents show their correct header information area), maybe the scroll position for the old frame is lost somehow by doing so?

Perhaps anyone has some hint for me as to what I could look at, check etc...I'm just lost atm.
 
D. Ogranos
Ranch Hand
Posts: 214
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think I've found the cause of the problem. There's a little bit of Javascript at the beginning of the JSP which does a top.location.href to itself when the page is shown through a link in a document. When I commented this out, the scroll position is kept after clicking a link and using browser back. I guess I will have to find a way around this JS...at least it is no general problem with the IFrame!
reply
    Bookmark Topic Watch Topic
  • New Topic