aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes hooking to browser instance through javascript Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "hooking to browser instance through javascript" Watch "hooking to browser instance through javascript" New topic
Author

hooking to browser instance through javascript

Ranadhir Nag
Ranch Hand

Joined: Mar 09, 2006
Posts: 138
We can use attachevent to listen to events on a document.
But we wish to open a new browser instance(window.open) and hook into the events of that particular browser instance-how do we do that?
We want to provide a recording functionality which allows us to record all user actions/navigations on a browser instance.
Is this possible through javascript?
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
well you store a reference of the object

var newWin = window.open(...);

than you can reference the child with that variable

example of referencing the form of a child would be:

newWin.forms[0].elementName.value = "foo";

Eric
Ranadhir Nag
Ranch Hand

Joined: Mar 09, 2006
Posts: 138
Thanks Eric.
But I had an idea that we can sink listeners only if the new page belongs to our domain.If we open a URL belonging to another domain,ther would be some security issues involved is what I hear.
Though I could not get any reference on that - can you comment?
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
You can not do cross domains. Major security risk.

The Firefox Extensions that do monitoring embed an iframe into the page and attach listeners that way.

Eric
Ranadhir Nag
Ranch Hand

Joined: Mar 09, 2006
Posts: 138
Can you point me to some refernce document which explains the extent of the problem - since we intend to provide a QA recording solution ,which would most definitely involve recording events on non-host domains,it would be nice if we can understand the issues involved before stroking down this approach.
Thanka a lot for the help again.
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
It is part of the spec that you can not do cross browser requests. It is so you can not read someones bank account. You might want to try to look through the ECMA docs or Mozilla Docs.

Eric
Ranadhir Nag
Ranch Hand

Joined: Mar 09, 2006
Posts: 138
Does this mean that for cross-domain recording there is no javascript option available - but would have to go throgh the IWebBrowser route?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: hooking to browser instance through javascript
 
Similar Threads
site development
trapping jsf component events from browser
Identifying events with javascript functions registered
Features in HTML5 that might help a better mobile web pages
JSP and button events