Problems with registering click event listener to a frame-element

Posted by distractedBySquirrels on Stack Overflow See other posts from Stack Overflow or by distractedBySquirrels
Published on 2010-03-22T11:58:54Z Indexed on 2010/03/22 12:01 UTC
Read the original article Hit count: 388

Filed under:
|
|
|

Hi everybody,

I ran into a problem with adding an event listener. I wrote a Firefox plugin a while ago for my bachelor thesis. It was based on a different attacker model than you would normally expect. In this scenario the attacker was the service provider (like Facebook, Google,...), who reads all your private data stored on their site (via JS).

My final solution was to temporally allow JS (while the page loads and after an user action occured). To observe the interaction I used event listener, which worked very well so far. But last week I noticed that my approach doesn't work with web sites which are using a frameset (I added the event listener to the body...).

So I tried to add the listener to the frameset respectively to the frame. But the clicks are only noticed when you actually click on the frame... (eg resize the frame with your mouse) But I want to register clicks on the document loaded inside the frame.

I already tried the .frameElement. Sadly it seems that Firefox doesn't like my (or, which is more likely, I'm too stuipd :) ) and claims there are no frames...

Could anyone tell me how to add an event listener to the document inside a frame? The web site looks like this:

<html>
<head>
<title>Frameset Test</title>
</head>
<frameset cols="150,*">
  <frame src="nav.html" name="Navigation">
  <frame src="main.html" name="Main">
</frameset>
</html>

This was my first bigger projekt with Mozilla so this could be a really dumb failure of mine... I hope you guys can help me. Thanks in advance.

Sebastian

© Stack Overflow or respective owner

Related posts about event

Related posts about listener