I am currently in the process of developing a simple, cocoa document based web browser in Objective-C, using the webkit framework.
I want to add a window to display the browsing history. I have created the window with a text box and all that, but I can not for the life of me figure how to display the browsing history in the textbox.
Please do not refer me to the apple developer resources online, as I have already read that.
First of all, you need to enable the web view’s built-in history with
setMaintainsBackForwardList:, if you haven’t already done so.You can then access the browsing history with the
backForwardListmethod which returns an object of the classWebBackForwardList.This isn’t a simple array, because it also needs to maintain a position within the history, in case the user goes back (to be able to go forward again). To display a history menu or window, you’re probably most interested in the
backListCountandbackListWithLimit:methods. The latter returns anNSArrayofWebHistoryItemobjects. Those have the methodsURLString,title,iconandlastVisitedTimeInterval. You can use these methods to display information about the individual history items.