on ‎2016 Nov 28 6:53 AM
Hi,
Documentation tells that onExit() calls by framework when view is destroyed.
Does any one know whether Controller's onExit() will be called either on page "refresh" OR closing browser tab.?
Thanks,
Srinath
Request clarification before answering.
Ok.
Is there any way to distinguish between "refresh" and "tab close" of a Browser by using UI5 ?
Thanks,
Srinath
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
yes, i think you can use navigation.type which will return you the navigation type, it will return 1 or 0 (not sure) on browser refresh.
check below code inside beforeunload function.
window.addEventListener("beforeunload", function (oEvt) {
if (oEvt.currentTarget.performance.navigation.type == 1){
alert("refresh called!");
}
});
OR
Store a cookie the first time visits the page, and you can check this key in beforeunload function whether your key is exists or not, if yes then browser refresh called.
Hope this help.
Regards,
Akhilesh
Hi Akhilesh,
Got the solution for above issue, where we are getting "0" on refresh for the first time.
"For the first time the page was loaded by direct navigation. Then subsequent reloads will set '1' on refresh, because the page is now loaded by reloading."
Thank you so much!!!
By using '1' on refresh i will keep condition to not execute the code.
Thanks,
Srinath
| User | Count |
|---|---|
| 13 | |
| 8 | |
| 7 | |
| 5 | |
| 4 | |
| 3 | |
| 2 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.