[TIMOB-510] implement go forward and go back methods on web view
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Medium |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2011-04-17T01:53:20.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 1.2.0 |
Components | iOS |
Labels | ios, iphone, webview |
Reporter | Nolan Wright |
Assignee | Jeff Haynie |
Created | 2011-04-15T02:30:37.000+0000 |
Updated | 2011-04-17T01:53:20.000+0000 |
Description
see UIWebView spec (from community)
Hi,
I've seen this asked quite a lot. http://developer.appcelerator.com/question/671/webview-navigation"> http://developer.appcelerator.com/question/671/webview-navigation
Would it be that hard to implement? (given the existing functionality available in the iPhone SDK? - see my reply)
Here's a link to the UIWebView spec (see 'Moving back and forward') http://developer.apple.com/iphone/library/documentation/UIKit/Reference/UIWebView_Class/Reference/Reference.html"> http://developer.apple.com/iphone/library/documentation/UIKit/Refer...
I did try to come up with a way around it, using the webView's 'load' event and building a history stack, however, when clicking a link on a remote page to another one, the 'load' event does fire again, but still has the same e.url value from when the webview was created.
It would be nice to have something like myWebView.goBack() , myWebView.goForward() with myWebView.canGoForward and myWebView.canGoBack
Is there a plan to expose a bit more? For example: getCurrentUrl?
Or an update to the url property that updates the value as the user navigates around in the Web View?
Cheers! :-)
(from [b767ce113817a45e56910ce14d0ab2196e9dea3e]) [#510 state:resolved] added various web controls capabilities to iphone http://github.com/appcelerator/titanium_mobile/commit/b767ce113817a45e56910ce14d0ab2196e9dea3e"> http://github.com/appcelerator/titanium_mobile/commit/b767ce113817a...
OK this seems to be a much requested feature. i have committed a number of new capabilities. Currently for iphone but android will catchup.
New properties:
loading[boolean]: boolean indicating if the webview is loading content
New methods:
reload: reload the current webpage
stopLoading: stop loading a currently loading page
goBack: go back one entry in history to the previous page
goForward: go forward one entry in history to the page before the current page
canGoBack: returns true if the webview can go back in history
canGoForward: returns true if the webview can go forward in history
New KS test called WebView controls in WebView.
I also fixed the url property to correct reflect the state of the current document, not just the initial url that created the view.
This is fantastic, Jeff. Cheers! :-)