Page 1 of 1
In PageShow event can I determine what Page I am coming from?
Posted: Wed Jul 10, 2013 2:58 pm
by Roger
How can I determine what Page the app is coming from during a PageShow event? For example, during PageShow I am executing a service call to get data. When I click on the data I will navigate to another page. If I then click the back button to return to original page the PageShow will fire again and execute that same service call when it is not needed. Is there a way to determine when I am coming from before executing my service call?
In PageShow event can I determine what Page I am coming from?
Posted: Wed Jul 10, 2013 3:39 pm
by Maryna Brodina
Hello! You can check previous page name on Page Show event using the following JS:
codevar prevPageName = '';
if(arguments[1]["prevPage"][0]) {
prevPageName = $(arguments[1]["prevPage"][0]).attr("dsid");
}/code
There is also another way - you can create local storage variable and before service call check - if variable is set then call the service, else - do not call the service.
In PageShow event can I determine what Page I am coming from?
Posted: Wed Jul 10, 2013 5:11 pm
by Roger
That works great. I had something working with local storage but like this method better.
Thanks for all the help.
In PageShow event can I determine what Page I am coming from?
Posted: Fri Jun 06, 2014 2:09 pm
by Sam6522984
Hi there
I tried the code you provided Maryna, unfortunately I get an exception because arguments[1] is undefined. Do you have an idea what's going wrong?
Thanks for your help
Samuel
In PageShow event can I determine what Page I am coming from?
Posted: Fri Jun 06, 2014 3:57 pm
by Evgene Karachevtsev
Hello Sam,
Unfortunately you can't do this:
http://stackoverflow.com/questions/40...
But you can write name of the page in localStorage, and after that you can read it on the next page.
In PageShow event can I determine what Page I am coming from?
Posted: Tue Jun 10, 2014 8:20 am
by Sam6522984
Hi Evgene
Thank you for your suggestion, I'll work with the localStorage approach.