开发者

Display web browser history

开发者 https://www.devze.com 2023-02-22 15:41 出处:网络
I am currently in the process of developing a simple, cocoa document based web browser in Obje开发者_Python百科ctive-C, using the webkit framework.

I am currently in the process of developing a simple, cocoa document based web browser in Obje开发者_Python百科ctive-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 backForwardList method which returns an object of the class WebBackForwardList.

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 backListCount and backListWithLimit: methods. The latter returns an NSArray of WebHistoryItem objects. Those have the methods URLString, title, icon and lastVisitedTimeInterval. You can use these methods to display information about the individual history items.

0

精彩评论

暂无评论...
验证码 换一张
取 消