Access inside of iframe

0 views
Skip to first unread message

Allen Ramsey

unread,
Sep 19, 2013, 9:46:45 AM9/19/13
to node-...@googlegroups.com
Is there anyway to access the DOM of the page loaded on the inside of an iframe? I know it's currently prevented with most browsers, but is it enabled in node-webkit?

ex: 

<iframe id="blah" src="http://www.google.com">

like, could I get the current text from the searchbar? (element id=gbqfq) ?

Allen

unread,
Sep 19, 2013, 8:26:21 PM9/19/13
to node-...@googlegroups.com
Solved my own question with a little bit of trial and error, just following up for any future newbies like myself.

here's what I finally came up with:

iframe = window.document.getElementById("iframe");
iframedoc = iframe.contentDocument || iframe.contentWindow.document;
iframedoc.getElementById('gbqfq').value='Test';

that's a way to SET, can also use it to GET as well. 
 
I continued my research on how to do it after reading and finding it was possible here: https://github.com/rogerwang/node-webkit/wiki/Security

This definitely makes webscraping quite easy.

Thanks for such a great product!
Reply all
Reply to author
Forward
0 new messages