Back Button

30 views
Skip to first unread message

Michael Jones

unread,
Jul 27, 2015, 11:57:35 PM7/27/15
to phonegap
I am trying to incorporate a back button. My iPhone users do not have a built in back button like us Android users. Is there some JavaScript that can tell what page a user came from? So I can send them back to the correct page each time?

Jesse Monroy

unread,
Jul 28, 2015, 12:23:09 AM7/28/15
to phonegap, mikej...@gmail.com
@Michael,
most of the SPA (Single Page Application) Frameworks can deal with this.
Ionic, Sencha Touch, -- just to name a few. I have NOT worked with them. I have my own
frame work. However, I believe they all have solutions that require you to decide what
you are going to do. For example, you could

* have a back button in the top left corner
* you could implement a swipe forward and backward
* you could implement a collaping (accordion-style) document

Sorry, that's best I have for you. I'm sure other have some ideas.

Jesse

Michael Jones

unread,
Jul 28, 2015, 1:55:50 AM7/28/15
to phonegap, jess...@gmail.com
I am planning on making a back button in the top left corner that will replace the slide out drawer button. 

Jesse Monroy

unread,
Jul 28, 2015, 2:04:19 AM7/28/15
to phonegap, mikej...@gmail.com
Okay. Then most any of the Frameworks should work.
From what I know they are using "URL routing", I disagree with the design, but most people
seem to like it. As such, Angular is the most popular choice. When you look deeper, they
generally refer to this as  "App routing", "path routing", etc. It is all based on REST API theory

Leading Choices
https://www.meteor.com/
https://angularjs.org/
https://jquerymobile.com/

If you google search "angularjs vs", then you'll see a bunch of the choice.
NOTE: I do not know which will NOT work with phonegap, but I expect most will

Best of Luck
Jesse

Rob Willett

unread,
Jul 28, 2015, 2:41:28 AM7/28/15
to phon...@googlegroups.com
Michael, Jesse,

I use the Ionic framework for 'routing' and agree with Jesse that I also dislike the design choice made BUT routing is not simple however it is necessary or indeed crucial. 

Unless you have a trivial app (trivial here means only one or two 'pages', rather than not very complex) you need to maintain some sort of routing state and history. Most apps will have more than one or two 'pages' as the screen estate is not very big and so you simply can't get enough information on one screen. I recognise that tablets with 1920x1080 resolution are challenging this notion, however lets forget that for the moment. 

Our app (which we thought was quite simple) has 

1 A main screen,

2. A tab menu at the bottom for al the screens.

3. A Left side menu off the main screen

4. A right side menu off the main screen

6. Sub-view of the main screen showing details about a specific traffic disruption

7. Sub-view off the main screen showing the picture from a specific traffic camera 

8. Another main screen showing a list traffic routes 

9. A sub view showing details of a specific traffic route

10. A settings screen.

We also have push notifications coming in, if the push notifications come in whilst we are in the foreground, we simply store them in a the left side menu. If they come in whilst we are in the background, then we have to navigate from ANY of the above 10 screens to the correct screen AND maintain the navigation and history state. Back buttons need to appear correctly. This is not easy and whilst I don't like the notion of URL routing in Ionic, it does work.

I would very strongly suggest that you study the routing for whatever framework you have chosen and put some time in to getting to understand it properly and to making it sure it works otherwise you will confuse your user.

Rob

 

--
-- You received this message because you are subscribed to the Google
Groups "phonegap" group.
To post to this group, send email to phon...@googlegroups.com
To unsubscribe from this group, send email to
phonegap+u...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/phonegap?hl=en?hl=en
 
For more info on PhoneGap or to download the code go to www.phonegap.com
---
You received this message because you are subscribed to the Google Groups "phonegap" group.
To unsubscribe from this group and stop receiving emails from it, send an email to phonegap+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Steve Husting

unread,
Jul 28, 2015, 10:33:56 AM7/28/15
to phonegap, mikej...@gmail.com
If yours is a multi-page app, then use something like this:

< button onclick="goBack()">Back</button>

function goBack() {
    window.history.back();
}

On Monday, July 27, 2015 at 8:57:35 PM UTC-7, Michael Jones wrote:

Jesse Monroy

unread,
Jul 28, 2015, 6:22:34 PM7/28/15
to phonegap, mikej...@gmail.com, shus...@aeteam.net
Another alternative is to use the EVENT API in Cordova/Phonegap

My Notes:
https://github.com/jessemonroy650/Phonegap-Events-test

You want to look at Phonegap-PhysicalButton-test

Jesse
Reply all
Reply to author
Forward
0 new messages