i invoked some javascript into my webbrowser.
the aim was to get the history.length, and if the length == 0, exit the app on backkey pressed.
so i used window.external.notify(history.length +”);
in browser_Scriptnotify: int16 navicounter = Convert.ToInt16(e.value);
the problem is, the history.length value is growing with each goBack(), i thought it would be shrinking ..
anybody got a solution for me? i need an indicator if i’m at the first page of the history or not.
thanks
Look into window.on(‘statechange’,…) and window.on(‘popstate’,…)
or you can use progressive enhancement of browser-storage(BS), along with cookies.
-User lands on site. Create cookie/BS with value of 0
-User lands on a new page and cookie is set.
-Get the value of the cookie
-Add 1 to value of cookie/BS
-Re-Set the cookie with the new value
-JS needs cookie
-Fetch cookie value
-Process JS
-User leaves site.
-Remove cookie/BS