Dynamic web pages (Javascript) - monitoring content from the outside

Suppose I am viewing a certain web page that uses JavaScript to update its view constantly (using Web 2.0 techniques to talk to my server about receiving data updates).

Now I like to run some code on my own computer that monitors the content and alerts me if certain data appears on the page so that I can write that data, for example.

I am looking for ways to do this. Since this is a private project, I am flexible in my choice of tools (I can program in C and REALbasic, and I could also manage a little JavaScript). The only thing that is not controlled is the page that I want to control.

I would prefer a solution that I can use on Mac OS X, but Linux and Windows would be possible too.

First, I am wondering if there are solutions for this. Something like a custom web browser for example.

If this is not available, I am wondering how best to approach this by programming it myself. For example, can someone tell me if Apple Webkit allows me to inspect a dynamically updated web page?

As a last resort, I think I would have to inject my own javascript code into the webpage being viewed (I could do this easily, in my opinion, while the page is loading over the internet) and then you have a script to run periodically by browsing the page it is on. The only thing I don't know in this case is how to get it to communicate with the external one, that is, with my computer. I could, of course, write an application that he could talk to, but how could he even access my computer resources to establish such communication? As I understand the sandboxing of web pages, they cannot read / write local files or communicate with a socket on the computer they are running on, or can they?

So, any ideas are welcome if they disagree with the concept that I should let the browser or its engine render the page and run Javascripts pages.

0


a source to share


3 answers


It looks like it could be pretty easy with Jetpack in Firefox.



You can build browser extensions with Javascript - it's still in alpha, but looks workable (and awesome) ...

+1


a source


I agree that you can definitely do this with a Firefox extension (I haven't used JetPack and I don't know if it can handle it). Firefox extensions can interact with arbitrary XPCOM components . So the extension will have a small piece of JavaScript to fetch data from the DOM and then link to a C ++ (XP) component to do something else.



See Building a C ++ XPCOM Component and Building Custom Firefox Extensions Using Mozilla's Build System

+1


a source


In fact, I just realized that the Monkeybread plugin for REALbasic offers everything I need and is much simpler than what Jetpack can do:

http://www.monkeybreadsoftware.de/pluginhelp/example-cocoa-domformfields.shtml

I can write my own browser that fetches web pages and then filters out the DOM data, even modifies it.

0


a source







All Articles