Page 1 of 1
iframe content
Posted: Thu Nov 15, 2018 9:43 am
by kwandjeen
How read a iframe content ?
Code: Select all
define elements
define iframe_content
define length_elements
!var v_elements = document.querySelectorAll("iframe");
!var v_length_elements = elements.length;
!var v_iframe_content = v_elements[0].innerHTML;
debug elements
debug length_elements
debug iframe_content
elements is a node object
length_elements is ok
iframe_content is empty
If anyone has a solution
Re: iframe content
Posted: Thu Nov 15, 2018 9:49 am
by Peter
kwandjeen wrote:iframe_content is empty
This is because the page may not yet be completely loaded?
Greetings ... Peter
Re: iframe content
Posted: Thu Nov 15, 2018 10:33 am
by kwandjeen
if i call a function with
I have the same result
Re: iframe content
Posted: Thu Nov 15, 2018 10:59 am
by Peter
kwandjeen wrote:if i call a function with
I have the same result
without knowing your code: if the page in your iframe does not come from the same domain as your app, you cannot access its content.
https://developer.mozilla.org/en-US/doc ... gin_policy
Re: iframe content
Posted: Thu Nov 15, 2018 11:18 am
by kwandjeen
Ok that's it
I load a web page in webgadget and spiderBasic use the iframe.
In google chrome I read the div tags by injection of javascript in console. Can we do the same thing with spiderBasic ?
exemple
Code: Select all
var elements = document.querySelectorAll("div");
for (let element of elements){
console.log(element.title);
}
Re: iframe content
Posted: Thu Nov 15, 2018 12:25 pm
by Peter
kwandjeen wrote:In google chrome I read the div tags by injection of javascript in console. Can we do the same thing with spiderBasic ?
Unfortunately, I don't understand your question. Can you describe that in more detail?
Re: iframe content
Posted: Sun Nov 18, 2018 5:11 pm
by kwandjeen
Load a web page with google chrome browser.
In console of developer tools i write the line
Code: Select all
var elements = document.querySelectorAll("div");
for (let element of elements){
console.log(element.title);
}
And in the console i can read the list of div tags title.