Click to See Complete Forum and Search --> : detecting clic event in window objet


pym59
09-25-2003, 05:49 AM
Is it possible to detect (capture ) click events in the same window. Example

I have a window with two frames:
1. a little frame at the top displaying anc counting the click in the window
2. a big one, the rest of the window, displaying webpages, which are not on the same server (for example www.altavista.com)

Is it possible to detect when the user click something in the frame containing the page www.altavista.com so that i can count the clicks in the upper frame.

I have no idea if it is possible and in which language this could be implemented
I have seen several examples, how to capture click event in a document, when i try to replace document with window, this dont work anymore

any ideas or is this exactly what it is not possible to do for security reasons
thanks


<SCRIPT LANGUAGE="JavaScript">
<!--
var flag = (window.Event)? true : false;
function documentHandler(e) {
if (flag) {
elem = e.target;
} else {
elem = window.event.srcElement;
}
alert('Element' + elem);
}
function clickHandler(e){
alert('Evenement transmis au niveau du bouton de formulaire.')
}
if (flag) {
document.captureEvents(Event.CLICK);
}
document.onclick = documentHandler;

// -->
</SCRIPT>

Khalid Ali
09-25-2003, 08:21 AM
if page you have loaded in a frame is served by an external domain(such as altavista.com) you can not capture events or do anything with that document.its browsers security modal that does not allow this.

pym59
09-28-2003, 12:58 AM
Is it possible to see which url is load in the document, also if the document is coming from another server something like

newlocation = ...layers[0].location;

Thanks