Page 1 of 1

Back Issue OnLoadError rendering with LoadUrl best approach?

PostPosted: Mon Dec 09, 2019 11:51 am
by mitchc
With recent changes using LoadString for error handling was ruled a bad idea:
https://bitbucket.org/chromiumembedded/ ... ce-and-get
https://bitbucket.org/chromiumembedded/ ... imple-when
https://bitbucket.org/chromiumembedded/ ... -makes-the

and was removed in newer commits all together.

LoadUrl with a base64 encoded error message seemed like a good stop gap for displaying OnLoadError messages to the user.

The problem with this is is LoadUrl adds a new navigation entry to history as well. When this is mixed with the fact there is only GoBack/GoForward short of walking the history tree then manually navigating back to the entry from two before there is not a great way to support the back button properly.

Currently assuming a non temporal error OnLoadError is called when visiting errorsite.com this then leads to LoadUrl being called with the error message causing bath in the history stack. Hitting back navigates again to errorsite.com which immediately would cause OnLoadError to trigger resulting in the user being stuck.

A work around is to detect on an error page and inject javascript of history.go(-2) on back request which works but is clumsy to a degree.

The cleanest options would seem:
1) Rendering an error page outside of the browser itself
2) On option to not add (or to remove) entries from the navigation history, so back works as expected
3) To intercept the error earlier in the chain and return custom text for the page as is bypassing OnLoadError.

Re: Back Issue OnLoadError rendering with LoadUrl best appro

PostPosted: Mon Dec 09, 2019 12:39 pm
by mitchc
The LoadUrl is used by the sample client for example:
https://bitbucket.org/chromiumembedded/ ... ler.cc-149

so it is subject to the same issue (browser to a invalid domain for example and try to go back).

Re: Back Issue OnLoadError rendering with LoadUrl best appro

PostPosted: Mon Dec 09, 2019 1:06 pm
by magreenblatt
You raise valid points. See the comment at https://bitbucket.org/chromiumembedded/ ... t-52020179