Access DOM inside chrome from native application - c++

I need to access DOM of web application that is running inside Chrome browser.
Same functionality can be achieved quite easily with IE using
SHDocVw::ShellWindows and SHDocVw::IWebBrowser2. Now I have to support Google Chrome and it seems that there is no simple way to achieve that.

The Chrome browser doesn't expose its DOM to external processes. You need to be in process. So in order to access the Chrome browser's DOM you need to be inside a Chrome extension.

Related

reCaptcha Is not loading in Custom Web Browser Desktop Application MFC,C++

I have custom web browser which is build using COM and Active X control using C++ or MFC.
In custom web browser am passing the my URL/Page which is having code to load the recaptcha " " its not loading buts its working fine in normal browser.
https://www.google.com/recaptcha/api.js i can see in the fiddler this URL is redirecting to webworker.js, anchor.htm and bframe.htm.
but from custom web browser after this "https://www.google.com/recaptcha/api.js nothing happening i mean its not redirecting to webworker.js, anchor.htm and bframe.htm.
I have use the IDocHostUIHandler if want you can grow through the following links "https://msdn.microsoft.com/en-us/library/aa770041(v=vs.85).aspx#WebBrowser_Customization_Architecture"
I have enable the downloading in my custom Web Browser i can see the downloaded files such the script, theme, css or html page and also "recaptcha__en[1].js" in machine expect webworker.js, anchor.htm and bframe.htm.
Please Help me out.
Thanks and Regards

Using GDI+ vs HTML page

I am working on an application which is UI intensive (i.e. we need to customize all the control to look different).
For this is I planned to use GDI+ in win32. But one of the suggestion form our team member is,
Instead of using GDI+ he asked me to have a web browser control, in that he asked me to display local html.That html page contains customized controls.
Form his suggestion I created a web control and used some UI intensive local html pages. That looks good.
But my question is, is it is a good idea to use web control to solve this?
Using a web browser control to solve this problem is common. There are many applications out there that already do this. For example Steam uses Chromium instead of the web browser control to do all its window skinning. Windows 8 metro is another example of an HTML-based interface. There are even entire frameworks built on html-based interfaces such as Appcelerator. There are many benefits to going the web browser control route but it is not easy to get it right.

Run userscript within the IE web browser control in a MFC application

I am developing a C++ application using the Internet Explorer webcontrol. I would like to use some userscripts to modify the webpage.
Do you have ideas how I can achieve this?
You're looking for IHTMLWindow2::execScript().

Is it possible to embed a HTTP server in a Google Chrome extension?

Do you think it would be possible to embed a HTTP server inside a Google Chrome extension?
I've seen other Google Chrome extensions execute native code and apparrently they do it by using NPAPI, but I have no idea what that is. And it's really freaking me out, as I'm no C++ expert or anything like that. So I feel a little stuck now and that's why I'm asking for help.
Specifically, I want to create an extension for Chrome with features similar to Opera Unite. For those who don't know what I'm talking about: Opera Unite is basically a zero-conf web server bundled with the browser. I don't want to use it for the same things Opera does, but I like the concept.
I was thinking about using something like node.js inside the browser to create a simple web interface to control some stuff in the browser. Think of it as a remote control for the browser. If node.js isn't possible I'd like to use lighthttpd or something similar. The technology really doesn't matter as long as it allows me to receive commands over HTTP.
But how do I take an existing web server and make a NPAPI plugin out of it?
Clarification: I'd like any browser to be able to communicate with my extension. Especially I want mobile devices like Android or the iPhone to be able to remote control the browser. Is there any other way to accomplish that except with a HTTP server?
Another update: I think the easiest way to do this would be to use a relay server on the web like Pusher or some self-created service. But I don't like this approach because it requires constant internet access and because it's a paid service.
Thank you all!
If you want to do a remote control for the browser, would something like HTML5 WebSockets work for you?
http://www.html5rocks.com/tutorials/websockets/basics/
You can have an external "remote" server that your extension listens to via WebSockets. If you want to host a webserver via extensions. You would need to use NPAPI, there are many C++ libraries out there (Google search) that can do a simple webserver. But I would rather use WebSockets communicate to an external server which will provide you anything you want.
But if you insist, you would need to learn C++, NPAPI, there are many examples online regarding NPAPI.
Here is another web server implemented with chrome.socket: https://github.com/kzahel/web-server-chrome. The server example linked to in chrome-app-samples is actually really buggy and will lock up if you e.g. hold down Ctrl-R on a page served by it.
Here is info on making a web-server in a Chrome app:
https://developers.google.com/live/shows/7320022-5001

Can I use XPCOM to create and manipulate a Firefox window as I would use win32 COM with IE?

With win32 COM I create an Internet Explorer instance and control it almost fully from my python code (manipulate windows, DOM elements, etc). More specifically, using DispatchEx('InternetExplorer.Application'). Can I do the same using XPCOM and C++/python?
I need to automate certain actions taken on the html ui of some websites, so no I can't use urllib and I can't use selenium, because it doesn't work with cross-domain urls. I've wrote a wrapper class for Internet Explore where I can create a browser window and do anything with it, but I would like to do the same with firefox as well. I've thought about creating a XUL application that exposes the DOM functionality through a tcp server written in XUL/js. I'm not even sure that's possible, but if I can do everything from my python code without running xulrunner externally, much better.
I don't know about programmatically creating and controlling full Firefox instances, but Mozilla can definitely be embedded using XPCOM.
The Mozilla embedding FAQ, embedding how-to and the embedding APIs overview should get you started. There are also other means for embedding.
I have used the nsIDOMXULElement to attach event listeners in my XPCOM C++ code. I haven't tried modifying the UI, but it will probably work as well.
For an example on how to get an nsIDOMXULElement look at the call "SetVideoWindow" in Songbird's code here.