GoBack() & Reload

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

GoBack() & Reload

Postby lolovo » Wed Nov 15, 2017 5:24 am

Hello!

I have the following questions about the topic:

1) I would like to do several GoBack() calls to achieve needed page, but when I do, for example, 2 times GoBack() one by one only first GoBack call works and as result browser get previous page not before it. Is this a bug or not? Is there any way to produce what I want without execution of javascript like "window.history.go(-2)"?

2) Is loading state of browser always changed immediately after GoBack() or Reload() is called (that is browser->IsLoading() return true after GoBack/Reload call and CanGoBack()==true) ? How to realize is browser started processing of Reload and GoBack?

Thanks in advance!
lolovo
Mentor
 
Posts: 67
Joined: Fri Aug 12, 2016 6:11 am

Re: GoBack() & Reload

Postby magreenblatt » Wed Nov 15, 2017 11:09 am

The easiest way is to execute the "window.history.go(-2)" JS. You can use CefFrame::ExecuteJavaScript to do that. The GoBack/Reload methods cause immediate state changes.
magreenblatt
Site Admin
 
Posts: 12408
Joined: Fri May 29, 2009 6:57 pm

Re: GoBack() & Reload

Postby lolovo » Wed Nov 15, 2017 11:51 am

magreenblatt wrote:The easiest way is to execute the "window.history.go(-2)" JS. You can use CefFrame::ExecuteJavaScript to do that. The GoBack/Reload methods cause immediate state changes.


Thank you for reply! Sometimes Reload doesn't initiate load at all (browser->IsLoading() always false)... and I need to make LoadURL request.

Is it possible to make enhancement in future and make GoBack(int step) where step - num of steps to go back ?
lolovo
Mentor
 
Posts: 67
Joined: Fri Aug 12, 2016 6:11 am

Re: GoBack() & Reload

Postby magreenblatt » Wed Nov 15, 2017 12:29 pm

lolovo wrote:Is it possible to make enhancement in future and make GoBack(int step) where step - num of steps to go back ?

Already reported as https://bitbucket.org/chromiumembedded/cef/issues/2004
magreenblatt
Site Admin
 
Posts: 12408
Joined: Fri May 29, 2009 6:57 pm

Re: GoBack() & Reload

Postby cretz » Wed Nov 15, 2017 1:09 pm

It should be noted all of these client-side JS suggestions (e.g. for navigating history or exiting full screen) can often be overridden by the page. See https://jsfiddle.net/29sjhjs6/. So for anyone using CEF where they don't trust the page but they need to run client side JS, they have to override CefRenderProcessHandler::OnContextCreated, and do something like I did at viewtopic.php?f=6&t=13642#p35988. Just something to keep in mind for the security conscious that have expectations of client-side JS objects doing what they expect.
cretz
Techie
 
Posts: 34
Joined: Mon Jun 26, 2017 11:41 am


Return to Support Forum

Who is online

Users browsing this forum: No registered users and 59 guests