Good day everyone! The simplest task is to select an element and click on it. But the trouble is: the element is inside the iframe ! This raises the question of how to select an item by id using jQuery ? In the standard way, $("#someId") returns null .
Added by :
the frame is not on my domain (loaded with VKontakte)

  • Is the frame on your domain? - Sh4dow

1 answer 1

No This will not allow browser security policy. On plain js, a frame from its domain is called:

 var el = document.getElementById('myIframe').contentDocument.getElementById('myElement'); 

But the frame element from another domain cannot be accessed like this.

Theoretically, instead of a frame, you can load ajax via a curl proxy (request "/ myproxy.php? P = http: //vkontakte.ru / ..."), replace all references to your proxy in it and then click. But, hmm, again, it seems to me, I have provided for VKontakte and even such a dirty hack may not work.

  • Here is an ambush: (The question is not relevant, thanks for the clarification! - metazet