[TIMOB-510] implement go forward and go back methods on web view

GitHub Issuen/a
Resolution Date2011-04-17T01:53:20.000+0000
Affected Version/sn/a
Fix Version/sRelease 1.2.0
Labelsios, iphone, webview
ReporterNolan Wright
AssigneeJeff Haynie


see UIWebView spec (from community)


  1. kosso 2011-04-15


    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

  2. Fred Spencer 2011-04-15

    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! :-)

  3. Jeff Haynie 2011-04-15

    (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...

  4. Jeff Haynie 2011-04-15

    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.

  5. Fred Spencer 2011-04-15

    This is fantastic, Jeff. Cheers! :-)

JSON Source