Page 1 of 1

When page is loaded from cache, no page load event is invoked.

Posted: Mon May 06, 2013 11:14 am
by w

I have a select menu which is populated by a rest service.

When I test the app in the browser for the 1st time, everything is working ok.
But when I test it again, without clearing browser cache, then the select menu is not populated, presumably because the page load event is not triggered.

The same happens when I test native on a smartphone. 1st time ok, next time the menu is not populated.

I could use pageshow event, but the problem with this is that the pageshow event is also triggered when you use the back button (from the next page for example) and land on the page, then the select menu is repopulated with calls to the rest service. In case of back button, when using pageload event, the browser doesn't repopulate the menu, but it is also not empty, the select menu contains the values from the initial rest call.

So how can I combine this behaviour? I want the selectmenu to be repopulated when the app is started, but not when using the back button, then he should use cached items.


When page is loaded from cache, no page load event is invoked.

Posted: Mon May 06, 2013 11:17 am
by w

The pageshow event is even triggered when I select something from the selectmenu, because the selectmenu is shown as a dialog (because jquery does this when the selectmenu contains a lot of values), and when closing the dialog, a pageshow event is triggered.

So in my case, the pageshow event is triggered when the page is loaded, the selectmenu is populated while using a rest call, you choose something from the list, and then the selectmenu would be repopulated using a new rest call.
And this is not the behaviour that i want, because the 2nd rest call is totally unnecessary.


When page is loaded from cache, no page load event is invoked.

Posted: Mon May 06, 2013 11:21 am
by Alena Prykhodko

Hi!

Working on it. I'll update!


When page is loaded from cache, no page load event is invoked.

Posted: Mon May 06, 2013 12:04 pm
by Alena Prykhodko

Could you please share screen shot of mapping?


When page is loaded from cache, no page load event is invoked.

Posted: Mon May 06, 2013 12:12 pm
by w

When page is loaded from cache, no page load event is invoked.

Posted: Mon May 06, 2013 12:12 pm
by w

When page is loaded from cache, no page load event is invoked.

Posted: Mon May 06, 2013 12:14 pm
by w

And the service is invoked at the Page Load event


When page is loaded from cache, no page load event is invoked.

Posted: Mon May 06, 2013 12:50 pm
by Alena Prykhodko

The mapping looks right. Can you share the service URL?


When page is loaded from cache, no page load event is invoked.

Posted: Mon May 06, 2013 1:58 pm
by w

I solved it, there was a problem in configuring my service, which was configured with a sessionStorage variable.
So when the browser reloaded, or the native app restarted, al localStorage vars were still there, but the sessionStorage was gone.

Thank you anyway!


When page is loaded from cache, no page load event is invoked.

Posted: Mon May 06, 2013 6:25 pm
by Alena Prykhodko

Glad it's working.