[jbosstools-issues] [JBoss JIRA] (JBIDE-15814) CordovaSim: Need to implement navigator.app.backHistory

Ilya Buziuk (JIRA) jira-events at lists.jboss.org
Wed Nov 20 05:44:05 EST 2013


    [ https://issues.jboss.org/browse/JBIDE-15814?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12925272#comment-12925272 ] 

Ilya Buziuk commented on JBIDE-15814:
-------------------------------------

Steps for verifying:
1. Create new Hybrid Mobile Application Project
2. Update index.html
{code:title=index.html|borderStyle=solid}
<!DOCTYPE html>
<html>
  <head>
    <title>Back Button Example</title>

    <script type="text/javascript" charset="utf-8" src="cordova.js"></script>
    <script type="text/javascript" charset="utf-8">

    // Wait for device API libraries to load
    //
    function onLoad() {
        document.addEventListener("deviceready", onDeviceReady, false);
    }

    // device APIs are available
    //
    function onDeviceReady() {
      document.addEventListener("backbutton", function(e) {
          alert("backbutton event was fired");
        }, false);
    }


    </script>
  </head>
  <body onload="onLoad()">
      <button onclick="window.location = 'index2.html'">go to another page </button>
  </body>
</html>
{code}
3. Add index2.html file
{code:title=index2.html|borderStyle=solid}
<!DOCTYPE html>
<html>
  <head>
    <title>Back Button Example</title>

    <script type="text/javascript" charset="utf-8" src="cordova.js"></script>
    <script type="text/javascript" charset="utf-8">

    // Wait for device API libraries to load
    //
    function onLoad() {
        document.addEventListener("deviceready", onDeviceReady, false);
    }

    // device APIs are available
    //
    function onDeviceReady() {
      document.addEventListener("backbutton", function(e) {
    	  navigator.app.backHistory()
        }, false);
    }


    </script>
  </head>
  <body onload="onLoad()">
     <h1>Second file</h1>
  </body>
</html>
{code}
4. Run the project with CordovaSim
5. Press "go to another page" button -  the app will show index2.html
6. Press browserSim's back button - the app will show index.html 
7. Press backbutton again - the alert "backbutton event was fired" will be shown.

Note: However, when I run the app "On the android device", and press back button on the index.html page the app simply closes - no alert shown, so I've created JBIDE-16053

                
> CordovaSim: Need to implement navigator.app.backHistory
> -------------------------------------------------------
>
>                 Key: JBIDE-15814
>                 URL: https://issues.jboss.org/browse/JBIDE-15814
>             Project: Tools (JBoss Tools)
>          Issue Type: Feature Request
>          Components: browsersim
>            Reporter: Ilya Buziuk
>            Assignee: Ilya Buziuk
>             Fix For: 4.1.1.CR1, 4.2.0.Alpha1
>
>
> navigator.app.backHistory -  is android specific method used for navigation to the history action. It's not properly documented since it is not cross platform.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the jbosstools-issues mailing list