0

Is there a way to access $0 from chrome developer tool's console when a DOM node of an iFrame is selected?

Vinay K
  • 5,562
  • 1
  • 18
  • 27
  • Type $0 (or $ and number that corresponds to your history of selection) in dev console. What is the trouble you experience? – Kirill Slatin Mar 22 '15 at 03:38
  • $0 is printed as null. – Vinay K Mar 22 '15 at 04:18
  • works fine for me in latest M41. Whenever I select iframe itself or element inside it or element outside, the history ($0-$4) is updated accordingly – Kirill Slatin Mar 22 '15 at 04:29
  • @KirillSlatin, please check the attached screenshot. I'm using chrome 42(beta) – Vinay K Mar 22 '15 at 04:47
  • This [screenshot](http://imgur.com/DEzkHdj) shows it can work ok. Although when I tried to play according to your screenshot I managed to get the state you mentioned. But when I reloaded the page and went step-by-step deeper in iframe I couldn't reproduce. I think it's a Chrome bug which happens when DOM in dev tools gets outdated. Dev tools is not very good at refreshing DOM on the fly – Kirill Slatin Mar 22 '15 at 05:03
  • seems like the the iframe in your example is loaded from the same domain. Can you try with crossdomain iframe. – Vinay K Mar 22 '15 at 05:06
  • yes, nice catch! I would say more. I recreated the issue in jsfiddle specifying an iframe to google.com. The jsfiddle results iframe (which you correctly mentioned links to same domain) contained a nested iframe which linked to google.com. In such config neither of iframe's children were correctly added to history. I think you can report a bug to chromium – Kirill Slatin Mar 22 '15 at 05:25
  • You need to select the 'context'. See answer here: http://stackoverflow.com/a/8581276/135101 – Tyler Collier Jul 21 '15 at 15:39

1 Answers1

0

Unfortunately it is impossible.

JS from the top_frame (code executed in page context == in browser console) is able to access only DOM nodes in current page not in the other nested documents (iframes).

Ioann
  • 1