facebook

showURL web page closing: CLOSED

  1. MobiOne Archive
  2.  > 
  3. Getting Help – General
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #331443 Reply

    dynorodney
    Member

    Hi

    I’m aiming to do a pay section for an app and the only way i can do it is to use showURL to go out to the web. I can see how to make a page open with no address bar etc to make it look like part of the app but after the user has paid, i have to close the browser and get them to click a continue button in the app so the app can talk to the website again using ajax to make sure they paid.

    It seems window.close() doesnt work (well it didnt close it anyway) so the only way i have of offering a close facility is to have the navigation buttons and a close button at the top. I didnt really want the navigation buttons as ive got the address url itself switched off. I just wanted either the close button on its own, or a way of closing the window and returning back to the app with javascript so i can attach it to a web page button. The app is a native app by the way

    I’m doing

    
     phoneui.showURL('http://www.myurl.com', '_child', { showLocationBar: true, showAddress: false,  showNavigationBar: true, });   
    

    I havent yet tried the above with apple but it does open the url with nav buttons and X in the corner on android and when I hit X it returns me back to the app. I’d just prefer if i could have my own button on the web page that says “close and return to app”. Can it be done (that will work natively on apple and android) ? It would be acceptable for me to say “click the X in the corner to return to the app” but I’m striving for perfection 😉

    Thanks for a great product

    Tony

    #331606 Reply

    support-michael
    Keymaster

    > Can it be done (that will work natively on apple and android) ? It would be acceptable for me to say “click the X in the corner to return to the app” but I’m striving for perfection 😉

    We have this question in the queue for the dev team.

    #331616 Reply

    You can close ChildBrowser window only from main window. To do this you can subscribe for LocationChange event right after opening ChildBrowser e.g.:

    
    phoneui.showURL('http://www.myurl.com', '_child', { showLocationBar: true, showAddress: false,  showNavigationBar: true, });  
    
    window.plugins.childBrowser.onLocationChange = function( newLoc ) {
        window.plugins.childBrowser.close();
    }
    

    Then if you change the location in ChildBrowser window (by submitting a form of doing something else) this code from main window will close CB.

    _________________
    Aleksey
    Genuitec Mobile Team

    #331642 Reply

    dynorodney
    Member

    Aleksey

    Thanks for the info. In my situation the browser opens on our site to show a summary of the purchase and then a button click submits a form over to the credit card site and after card details are entered, thats when i want the user to be able to close the browser after payment (after 3 separate page changes). However, if the event can pick up on what the child browser url changes to, I can set a button on the website to go to a particular page and write the event to only close when newLoc is set the url Ive specified? This would mean the user can navigate between the 3 pages but as soon as they click a button to go to a specific page, the event picks that up and closes the browser window down. I shall try it this evening and let you know. Many thanks for the thought process !

    Tony

    #331643 Reply

    I can set a button on the website to go to a particular page and write the event to only close when newLoc is set the url Ive specified? This would mean the user can navigate between the 3 pages but as soon as they click a button to go to a specific page, the event picks that up and closes the browser window down.

    Exactly, the event handler function have newLocation parameter.

    _________________
    Aleksey
    Genuitec Mobile Team

    #331647 Reply

    dynorodney
    Member

    Aleksey

    Many thanks – that worked like a dream (at least on android JB – will test apple shortly). I can now have a “return to app” on the first payment screen in case they want to change anything and again on the post-payment screen, without having to say “click on close”. And in fact I can now also get rid of the navigation and close buttons too because the user can close it down from the screen and so I can make it look like part of the app. Oh happy days….

    Tony

Viewing 6 posts - 1 through 6 (of 6 total)
Reply To: showURL web page closing: CLOSED

You must be logged in to post in the forum log in