Reputation: 4017
i have 2 html page the first one is the login page and the second, when i login i redirect to the main page, there is a must must execute on load, only at the first load of the page after login this method must call. when i reload or refresh this method is call again.
1- can i refresh the page without calling the onload method? if yes how?
or
2- can i redirect to a specific method in the page to avoid calling the onload method every time? if yes how
or
3- can i write any thing in the onload method that keep me calling the method only at the first time? if yes how
Note: i know that in web application it is must call load function at each time the page reload, but is there any solution that i must do to solve this problem?
Upvotes: 3
Views: 639
Reputation: 19042
Two options:
?justLoggedIn
, or a value in the hash after #justLoggedIn
. Then check for that and redirect to the same url minus the justLoggedIn
part. The advantage of the #
version is that it doesn't actually reload the page, unlike when using the ?
version.Upvotes: 2
Reputation: 14014
You could refresh the page by redirecting to
[urlOfCurrentPage] + "?redirected=true"
and then in the onLoad method check if there is a GET "redirected" parameter in the URL, and if so, skip the onload.
Upvotes: 2