PDA

View Full Version : AJAX Scrolling problem in Safari


noleli2
2006-05-11, 12:02
I am currently writing a website to display the contents of an an XML file in a nice, human-readable form. (Way more than a normal table, so XSL will not suffice.) I update every five seconds. In order to do this, I remove all the childNodes I've added to the DOM and rebuild the whole thing with the newly-acquired XML data.

This works fine (and flicker-free) in the big three (IE, FF, Safari), but in Safari, if I'm scrolled down, when it rebuilds it scrolls back to the top. In the other two browsers, it does not do this.

Any thoughts on how I might be able to get it to stop doing that? Thanks.

pmazer
2006-05-11, 16:25
Without knowing exactly how you're going about this, I'll throw something out there:

Perhaps some sort of counter that remembers how far one has scrolled and scrolls that far down on refresh?

chucker
2006-05-11, 16:27
Have you checked whether recent nightlies of WebKit still have the issue?

rollercoaster375
2006-05-11, 16:49
AJAX shouldn't be used to load content</HTTP-URIpurist>

As for the issue at hand, I doubt this is something where you'll be able to find a fix. The only think you can hope for, as already stated, is that the recent WebKit builds fix it.

noleli2
2006-05-11, 21:13
AJAX shouldn't be used to load content</HTTP-URIpurist>
How would you go about polling an XML file for updates and rebuilding the DOM tree (well, not the whole thing, but all the children of a "contentgoeshere" div)?

chucker
2006-05-11, 21:15
How would you go about polling an XML file for updates and rebuilding the DOM tree (well, not the whole thing, but all the children of a "contentgoeshere" div)?

Well, you could start by telling us what it is, exactly, that you're trying to do. ;)

For example,
1) why do this transformation from XML to HTML on the client-side, instead of on the server-side?
2) why does it need to refresh automatically? Can't the user do that?

noleli2
2006-05-11, 21:31
Well, I was being deliberately vauge because there could be some IP issues, but I really don't think so, and our stuff has already been posted on the 'net, so whatever.

I'm working on a project that uses GPS to track the busses for the U of Michigan transportation department. For the public website, I'm working on a subway map-style display to show users estimated times until a bus gets to a particular stop.

The data is in an XML file that is updated every 5 seconds server-side. Therefore, I need to re-request it every 5 seconds. I rebuild the entire tree so that if a route or stop were to stop being serviced, I can reflect that.

The site is: http://ace.engin.umich.edu/public_web/
The JS is: public_web/subway.js
the feed that is currently being used (not the live one at the moment because not all the routes are running at this hour) is: public_web/Local Stuff/public_feed.xml