cancel
Showing results for 
Search instead for 
Did you mean: 

How to control browser back button or Android device back button in SAP

former_member309065
Discoverer
0 Kudos

Dear SAP,


How we can control browser back button or Android device back button in SAP UI5.
We want to display some confirmation message when user click on browser back button or android device Back Button.

Please advice

Accepted Solutions (0)

Answers (1)

Answers (1)

saurabh_v
Active Participant
0 Kudos

For displaying confirmation message when user clicks on the browser back button, you can implement the below code. Not sure though, whether the same code works in case of pressing the Android back button. Also, below code will only work when the app is called from within the Fiori Launchpad, and not as a standalone app.

In manifest.json file, within the "sap.ui5" configuration object:

		"services": {<br>			"ShellUIService": {<br>				"factoryName": "sap.ushell.ui5service.ShellUIService"<br>			}<br>		}

Within the onInit function of your controller:

this.getOwnerComponent().getService("ShellUIService").then(function(oShellService) {<br>				oShellService.setBackNavigation(function() {<br>					//display the confimation message<br>				});<br>			});