WPF WebBrowser Recent Pages

2019-07-13 02:28发布

问题:

Just wondering if there is a way to access the recent pages visited in the WPF WebBrowser. It obviously keeps track of the pages, as evidenced by by the Go[Forward/Back] functions. I am planning on making a database to keep track of it, but I didn't want to do extra work if it was pointless to do so. I am guessing those details are purposely hidden to the user.

回答1:

No I don't think that's possible, there's just the GoForward/GoBack methods to use. The history in the WebBrowser control seems to be tied into Windows (so opening a URL in your WebBrowser adds it to IE history and vice-versa), I guess that's why they've restricted access to it. Writing your own way to keep track may be a bit of duplicated effort, but it's the way to go in this case.



回答2:

Navigation control is handled by the NavigationService class and it appears that there is only a "Next" and "Previous" functionality supported.

I don't see any direct way of getting access to the whole chain of visited pages.