How to navigate to a navigation entry url

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.

How to navigate to a navigation entry url

Postby BobM » Thu May 19, 2016 1:43 am

Hi,
I'm using GetHost()->GetNavigationEntries(visitor, FALSE) to enumerate the navigation travel log (sorry, IE terminology) to build a back/forward menu as in Chrome or IE. In IE I would get an instance of ITravelLogStg and call its TravelTo method to navigate to the page without disturbing the travel log history. How do I achieve this - loading a url without changing the navigation enumeration - in cef? I've tried m_cefBrowser->GetMainFrame()->LoadURL(..) to load the url, but next time I enumerate with GetNavigationEntries the order is changed.
Thanks
Bob
BobM
Mentor
 
Posts: 72
Joined: Wed May 11, 2016 4:28 pm

Re: How to navigate to a navigation entry url

Postby magreenblatt » Thu May 19, 2016 9:12 am

Use the JavaScript history.go() API. You can execute the command using CefFrame::ExecuteJavaScript.
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: How to navigate to a navigation entry url

Postby BobM » Thu May 19, 2016 5:44 pm

Thanks - I'll give that a go.
Bob
BobM
Mentor
 
Posts: 72
Joined: Wed May 11, 2016 4:28 pm

Re: How to navigate to a navigation entry url

Postby BobM » Mon May 23, 2016 6:28 pm

Using window.history.go I can load a relative page, but it will not load a url as enumerated from the GetNavigationEntries. Also, it updates the order of the navigation history returned by GetNavigationEntries. Is there any way to navigate to a navigation entry so the order does not change, like Chrome/IE etc.?
Thanks
Bob
BobM
Mentor
 
Posts: 72
Joined: Wed May 11, 2016 4:28 pm

Re: How to navigate to a navigation entry url

Postby magreenblatt » Mon May 23, 2016 7:39 pm

BobM wrote:Using window.history.go I can load a relative page, but it will not load a url as enumerated from the GetNavigationEntries. Also, it updates the order of the navigation history returned by GetNavigationEntries. Is there any way to navigate to a navigation entry so the order does not change, like Chrome/IE etc.?
Thanks
Bob

What CEF version are you using? history.go(-1) should take you to the previous entry unless the page JavaScript is using history rewrite tricks during navigation.
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: How to navigate to a navigation entry url

Postby BobM » Mon May 23, 2016 8:56 pm

Thanks Marshall.
I was sorting the enumeration on the entry completion time rather than index. I was also using history.go(<url>) rather than a relative index. It's working now.
Thanks again.
BobM
Mentor
 
Posts: 72
Joined: Wed May 11, 2016 4:28 pm


Return to Support Forum

Who is online

Users browsing this forum: Google [Bot] and 83 guests