locked
After Logging In Wanting to not show "back" button. RRS feed

  • Question

  • I'm can't figure out how to not show the back button (navigation) after I successfully navigate to my "home" page from my "login" page.  That is, on my login page, upon successful login I do:

     WinJS.Navigation.navigate('/pages/home/home.html', { item: '' });

    Right now, on the home.html, there is a back button which I never want the user to see (they logout from the logout on the sidebar).  How can I correctly hide this back button.  I had a windows 8 review with a Microsoft reviewer last week and he said I should not have the login page in my navigation.  The banking example shows it in the hierarchary, but I can't actually run it without errors to see how it does it.

    Thanks


    Peter Kellner http://peterkellner.net Microsoft MVP • ASPInsider


    Sunday, July 1, 2012 3:47 PM

Answers

  • 1.  Remove the back button from the Home Page.  Since it is the root, you would never have a back button appear, and the navigation stack will not be relevant.

    2.  Call WinJS.Navigation.navigate from your login page to get to your home page.


    Jeff Sanders (MSFT)

    Tuesday, July 10, 2012 1:47 PM
    Moderator

All replies

  • Login guidelines are available at http://msdn.microsoft.com/en-us/library/windows/apps/Hh965453.aspx.  I would start with reading through those and the various options given for how to handle this scenario in general if you haven't already.

    For your specific scenario here, the back button is enabled as a side effect of the navigate call you make - see the 'navigated' function in navigator.js.  If you can never navigate back from the home page, you could just remove the back button from the markup.  If you have scenarios where that could be valid and you need to keep your current design, you'd have to modify navigator.js to have additional logic to decide if it should enable the back button.

    Hope that helps.

    ~Gearard


    This posting is provided "AS IS" with no warranties, and confers no rights.


    Monday, July 2, 2012 5:45 AM
  • I've seen that guideline before an though it is somewhat a help, it offers no code.  My question is specifically about how to do it. I'd appreciate if you could suggest a location that shows a code example.  In my review, the reviewer suggested NOT using navigation for login.  I can not figure out how to do that.

    Peter Kellner http://peterkellner.net Microsoft MVP • ASPInsider

    Monday, July 2, 2012 1:29 PM
  • Hi Peter,

    Simply provided a Flyout from the settings charm and get the user login information from there. 

    Here is the sample code that shows how to do this:

    http://code.msdn.microsoft.com/windowsapps/App-settings-sample-1f762f49

    -Jeff


    Jeff Sanders (MSFT)

    Monday, July 2, 2012 2:29 PM
    Moderator
  • Hi Jeff,

    I think I should have been more clear in my question and follow ups.  I had actually read the login guidelines earlier and in my case, I require a login so the flyout does not work for my issue (which is why I've been asking about the full page issue that comes up when my app starts).  So, to be more specific, here is my problem.

    Assumptions:

    •   Must Use full page login screen
    •   Can not use Navigation Because was told not to in my Windows 8 review by Microsoft

    So, given that, can you give me directions (examples or other) of how I can create a login page that is not a flyout that does not use navigation and DOES get me to my home page which IS a navigation on successful login.

    Thanks,


    Peter Kellner http://peterkellner.net Microsoft MVP • ASPInsider

    Monday, July 2, 2012 4:22 PM
  • Hi Peter,

    Can you us the OAuth (Authentication Broker)?

    -Jeff


    Jeff Sanders (MSFT)

    Monday, July 2, 2012 7:51 PM
    Moderator
  • No, I'm calling a json web service and passing in username and password.  It's my own simple ajax request

    Peter Kellner http://peterkellner.net Microsoft MVP • ASPInsider

    Monday, July 2, 2012 7:57 PM
  • You should be able to use this sample to get you close (last scenario).

    http://code.msdn.microsoft.com/windowsapps/Web-Authentication-d0485122

    -Jeff


    Jeff Sanders (MSFT)

    Monday, July 2, 2012 8:12 PM
    Moderator
  • Hi Jeff,

    I don't mean to be rude by keeping un-marking your answers as the proposed answer.  When I have the answer I will mark it as such.

    I think you are not seeing my question. It's about navigation and not login.  I've gone through the windows 8 samples both navigation and login.  My question is regarding how to have a full page login screen, that on success in my javascript, I can correctly navigate to the start of my true navigation. I need to do this in a way that complies with the windows 8 metro standards and the reviews of store apps.


    Peter Kellner http://peterkellner.net Microsoft MVP • ASPInsider

    Monday, July 2, 2012 8:54 PM
  • Peter, there's a difference between asking for help and asking for people to write the code for you. 

    If you don't want to show a back button on the home screen then remove it from the markup.  The way you are navigating is fine.

    Monday, July 2, 2012 9:29 PM
  • I would love to remove the back button as suggested, however I was told specifically not to do that.  I was told by Microsoft not to use the navigation template for the login.  That is what I am struggling with.  How to "Not" use the navigation template for the login. If you have a suggestion I would appreciate hearing it.

    Peter Kellner http://peterkellner.net Microsoft MVP • ASPInsider

    Monday, July 2, 2012 9:43 PM
  • They told you not to remove the back button from your home screen?
    Monday, July 2, 2012 9:56 PM
  • Peter,

    Use the Web-Authentication.  It does what you want. 

    -Jeff


    Jeff Sanders (MSFT)

    Tuesday, July 3, 2012 1:16 PM
    Moderator
  • Hi,

    I will mark the reply as an answer. If you find it no help, please feel free to unmark it and follow up.

    Thanks.

    Best Regards,

    Ming Xu.


    Please mark the replies as answers if they help or unmark if not.
    If you have any feedback about my replies, please contact msdnmg@microsoft.com.
    Microsoft One Code Framework

    Tuesday, July 10, 2012 11:12 AM
    Moderator
  • I never got the answer I was looking for here and still have the issue.

    Peter Kellner http://peterkellner.net Microsoft MVP • ASPInsider

    Tuesday, July 10, 2012 1:11 PM
  • Hi Peter,

    You can construct your own login page styled like the WebAuth login and show it for the login process, then bring it down when the customer logs in.  This will be the easiest way to accomplish what you want if you cannot change you service to use the WebBroker.

    -Jeff


    Jeff Sanders (MSFT)

    Tuesday, July 10, 2012 1:31 PM
    Moderator
  • I have the login page written the way I want it and the reviewer agreed is reasonable. My question is regarding how to have navigation such that the the home page is the root of my navigation, but when my login page comes up, it can navigate to the home page without the the back button coming up on the home page.  That is, I want the home page to be the root.  I want the login page to somehow load the home page which is what I can not figure out how to do.

    Peter Kellner http://peterkellner.net Microsoft MVP • ASPInsider


    Tuesday, July 10, 2012 1:34 PM
  • 1.  Remove the back button from the Home Page.  Since it is the root, you would never have a back button appear, and the navigation stack will not be relevant.

    2.  Call WinJS.Navigation.navigate from your login page to get to your home page.


    Jeff Sanders (MSFT)

    Tuesday, July 10, 2012 1:47 PM
    Moderator
  • thanks. that worked for me.  I thought I had tried that and had crashing issues.  I have a lot of visual studio crashing issues in general around JavaScript errors so it's often hard to tell what caused them.

    Peter Kellner http://peterkellner.net Microsoft MVP • ASPInsider

    Tuesday, July 10, 2012 4:57 PM
  • Sure Peter!

    Zap back on the forums if you run into anything else.

    -Jeff


    Jeff Sanders (MSFT)

    Tuesday, July 10, 2012 5:13 PM
    Moderator
  • I've got a simalary problem , but i want the user can't go back if certain states are active (like editing and not confirmed or cancel yet ).

    So i want to disable the BackButton while in "Edit mode"

    thanks

    WimK

    Sunday, February 3, 2013 3:25 PM
  • Please post a new question in the forum.  There are many different problems discussed already in this post.  Please be specific about what you are doing, the problem and what things you have tried so far to resolve the issue.

    Thanks!


    Jeff Sanders (MSFT)

    Monday, February 4, 2013 4:57 PM
    Moderator