Back Issue OnLoadError rendering with LoadUrl best approach?
Posted: Mon Dec 09, 2019 11:51 am
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.
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.