Headless browser with cef2go?

255 views
Skip to first unread message

nvcnvn

unread,
Jun 12, 2014, 6:37:30 AM6/12/14
to cef...@googlegroups.com
Hi all,

What I'm trying to do is a SEO tool for my Ajax website. The tool recieve and input URL (that I get from my site map), then return the rendered-html string from the website (that I can save to serve web crawler).

I wonder is there anyone using cef2go for a headless browser? I'm very new to this (webkit or any render engine in general) and it wuold be great if someone can show me some examples or hints :)

Thanks all :)

Czarek Tomczak

unread,
Jul 20, 2014, 4:50:06 AM7/20/14
to cef...@googlegroups.com
Getting the final html with rendered javascript can be done using javascript. Communication from javascript to Go can be done using XMLHttpRequests and a local webserver (see README). What we're currently missing is being able to inject javascript code at the start of page loading. That code would detect when the page has finished rendering, using the DOMContentLoaded event or other method depending on the design of the AJAX app, and then communicate with Go app. It would be required to implement the CefLoadHandler::OnLoadStart callback and the CefFrame::ExecuteJavascript method. The fork by fromkeith may have some of this stuff implemented.

Czarek Tomczak

unread,
Jul 20, 2014, 4:57:23 AM7/20/14
to cef...@googlegroups.com
You mentioned that the Ajax website belongs to you and that could make things easier. By adding some URL parameter or using some other method to detect that the website is being crawled by cef2go, you could inject the javascript code that will communicate with Go, on the server-side. That way there would be no need to implement the OnLoadStart and ExecuteJavascript mentioned in the previous post.
Reply all
Reply to author
Forward
0 new messages