0

I'm confronted with following problem: I have created a jquery-mobile application within salesforce, to be used on the ipad in salesforce one. In the app, the ipad back button is displayed.

If a user clicks this button, he leaves the jquery application (because it is technically only one page) and all inserted values are lost.

Is their any way to "catch" the back button event in javascript and have the user confirm (via a popup) that he wants to leave?

In the desktop browser it is quite easy to realize this via beforeunload &Co.

 $(window).bind('beforeunload', function() { ...

I'm now looking for a similar solution for the iPad app.

Best regards, Max

1 Answer 1

2

I was confronting the same issue a couple days ago.

As far as I saw/know, unfortunately you can't listen to this back action like in regular desktop apps. Because you're app is running in a child frame and the iPad back button is on the parent frame, so basically you can't listen to a parent page event from a child frame.

So I think the best way for you is just to design your app according to the SF1 app limitation.. (Maybe try to crate a welcome page (with same apex ctrl as you're app) that on pressing a button will move the user to the main app, that way when the user will push the iPad back button he'll be returned to the welcome page and because they have the same ctrl the data won't be lost)

Also, You'll have the same problem with the android SF1 app.

1
  • The idea with a welcome page maybe is worth a try. I think of some kind of placeholder page, which forwards the user to the actual page (jquery-app). By this I'd have two pages and thereby eventually could instrumentalize the back button again. I will update this post after I tried it out.
    – ma_wi
    Commented Aug 3, 2016 at 15:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .