Page 1 of 1

Single page application architecture and router based state.

PostPosted: Mon Nov 23, 2015 9:16 am
by irf
Hi,
I am using a Single page JsApp architecture with CEF via

- React
- React router

However i am not using html push state since in my case i am loading the html/js codebase via a file:/// url. So my urls essentially look like file://baseurl#/path1/argument1/argument2 etc.
Essentially the client side router is using the "#/path1" in absence of push state. The problem that i am facing is that when an application logic switches the url from one url to another the CEF is triggering a load and reloading the page.

I was not expecting this since url changes from file://baseurl#/path1/etc/ to file://baseurl#/path2/etc/. Since only the part after # is changing, this should be treated as a local anchor tag and should not cause a page load. Is this an expected behaviour or is this a bug in CEF. Any suggestions to deal with this issue would be welcome.

I am using Ubuntu 64Bit
CEF branch 2454

Thanks

Re: Single page application architecture and router based st

PostPosted: Mon Nov 23, 2015 10:28 am
by magreenblatt
How does it behave in Google Chrome?

Re: Single page application architecture and router based st

PostPosted: Mon Nov 23, 2015 10:29 am
by irf
Chrome does not reload the page.

Re: Single page application architecture and router based st

PostPosted: Mon Nov 23, 2015 12:06 pm
by magreenblatt
Can you provide a working example of the problem?

Re: Single page application architecture and router based st

PostPosted: Tue Nov 24, 2015 12:32 am
by irf
this is easily reproduced by loading "https://en.wikipedia.org/wiki/Multiple_inheritance" in cefclient test app
and clicking on different page headers (These are local "anchors" eg: https://en.wikipedia.org/wiki/Multiple_ ... e#See_also)

we are getting below callbacks on cefloadHandler

CefLoadHandler:: OnLoadingStateChange.--> isLoading: 1

CefLoadHandler:: OnLoadStart.

CefLoadHandler:: OnLoadingStateChange.--> isLoading: 0

Re: Single page application architecture and router based st

PostPosted: Tue Nov 24, 2015 11:37 am
by magreenblatt
The calls to OnLoadingStateChange are expected. Chromium's WebContentsDelegate::LoadingStateChanged method has an additional |to_different_document| argument that would be useful to expose in this case. Feel free to add an issue for exposing that argument.

Re: Single page application architecture and router based st

PostPosted: Wed Nov 25, 2015 8:38 am
by irf
Thanks for your reply.
I dont see a corresponding invocation CefLoadHandler ::OnLoadEnd for these. Is this expected as well?

Re: Single page application architecture and router based st

PostPosted: Wed Nov 25, 2015 12:41 pm
by magreenblatt
irf wrote:Thanks for your reply.
I dont see a corresponding invocation CefLoadHandler ::OnLoadEnd for these. Is this expected as well?

Yes. This was fixed in http://crbug.com/539952#c2 (currently master branch only).

Re: Single page application architecture and router based st

PostPosted: Tue Dec 01, 2015 11:28 pm
by irf
magreenblatt, I see that sure this period of time if there is a callback from javascript, it seems to not get executed. js context is not getting reset etc. It still functions after load. But during this time the callbacks seem to not do anything.