javascript - Detecting clicks on an embedded webpage -


let's have embedded web page on website (example: www.en.wikipedia.org/wiki/pulsar). user clicks on hyperlink inside article (ex: https://en.wikipedia.org/wiki/extrasolar_planet).

i want have frame displays name of article (in case, "extrasolar planet") when user clicks entry original article ("pulsar")

how know user has clicked?

edit: after seeing many examples, tried instead, doesn't quite work.

<iframe width="940" height="550" src="http://en.wikipedia.org/wiki/special:random">    </iframe>   <script> (document.getelementsbytagname('iframe').contentwindow.document).keydown = function() { alert("hello world") }) </script> 

this doens't work because you're using getelementsbytagname returns array. use getelementbyid or getelementsbytagname('iframe')[0] instead.


Comments