Member
Join Date: Jul 2004
|
Can anyone help me with a quick problem? I've been trying to figure out something about web browsers to implement in a program I'm writing. When ever you are viewing a web page (in IE or Firefox) and you navigate to another page, if you press the back button, the first page redisplays with the view centered at the same point you were at when you left it. Does anyone know how this is accomplished?
What I'm trying to do is have a program that displays a web page that will allow you to change the view of some numbers without the view resetting to the top of the page. Whenever the view is changed, I would like the page to stay in the same position. Thanks for any help you guys might have! Phenix |
quote |
Selfish Heathen
Join Date: May 2004
Location: Zone of Pain
|
These help:
If the first page was navigated to a certain place by clicking an anchor, when you go to another page and hit back, it'll take you to the place where it loaded at the anchor. For example, here on the forums, if you click the link on the main forum page to go to the last post in a thread, that's using an anchor. If you click that link to load that page, go somewhere else, and go back until you get to that thread again, the page will load at the location of the anchor you originally clicked. The quality of this board depends on the quality of the posts. The only way to guarantee thoughtful, informative discussion is to write thoughtful, informative posts. AppleNova is not a real-time chat forum. You have time to compose messages and edit them before and after posting. |
quote |
Member
Join Date: Jul 2004
|
Thanks Brad. The only problem is that in this case the navigation won't necessarily be by a link. What will happen (ideally) is the user will change the view option in a seperate frame and the page will refresh and when the page reloads, it will automatically move to the position it was at before so the viewer won't have to scroll to find the table again. Something similar happens in Firefox and IE, and I thought about browsing Mozilla's source to figure out how they do it, but at 15000+ files, I don't think it would be too efficient since I'm just looking for the code for their navigation buttons.
|
quote |
Selfish Heathen
Join Date: May 2004
Location: Zone of Pain
|
Hmm. Let's make sure I understand this fully first. You were looking at Mozilla's source code? So, I take it you're not actually writing HTML pages for the web, but you're writing a program that *behaves* similar to a web browser in that you can click things and go back and forth between pages, right?
Well, in that case, it all would depend on the language and API you're using and how exactly all of this is being implemented. Since I suspect you're using C#, I don't think I'd be much help. Here's a wild idea that should work in theory. If you can, say, subclass something that is a scrolling box (in Cocoa, for example, it's called a NSScrollView), you could override the method that actually repositions the content with something that will store the x,y location of the view's content into some kind of variable each time the view is repositioned. Then you could override the method that loads the view the first time so that whenever it is loaded, it checks to see if there is a nonzero value in that variable and, if there is, automatically scroll to it. That's how I'd assume web browsers handle these things internally. Of course, if I'm mistaken about what you're doing, please correct me. Details to the max are always helpful! The quality of this board depends on the quality of the posts. The only way to guarantee thoughtful, informative discussion is to write thoughtful, informative posts. AppleNova is not a real-time chat forum. You have time to compose messages and edit them before and after posting. |
quote |
Posting Rules | Navigation |
|
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
WAP (WML) Browser | Maciej | Genius Bar | 0 | 2004-07-31 15:13 |
that icon in the web browser address field | Mac+ | Feedback | 5 | 2004-05-17 11:29 |