iframe content

Using Javascript from SpiderBasic
kwandjeen
Posts: 6
Joined: Thu Oct 27, 2016 8:02 pm

iframe content

Post 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 :)
User avatar
Peter
Posts: 1086
Joined: Mon Feb 24, 2014 10:17 pm
Location: 127.0.0.1:9080
Contact:

Re: iframe content

Post by Peter »

kwandjeen wrote:iframe_content is empty
This is because the page may not yet be completely loaded?

Greetings ... Peter
kwandjeen
Posts: 6
Joined: Thu Oct 27, 2016 8:02 pm

Re: iframe content

Post by kwandjeen »

if i call a function with

Code: Select all

window.onloadend
I have the same result
User avatar
Peter
Posts: 1086
Joined: Mon Feb 24, 2014 10:17 pm
Location: 127.0.0.1:9080
Contact:

Re: iframe content

Post by Peter »

kwandjeen wrote:if i call a function with

Code: Select all

window.onloadend
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
kwandjeen
Posts: 6
Joined: Thu Oct 27, 2016 8:02 pm

Re: iframe content

Post 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);
}
User avatar
Peter
Posts: 1086
Joined: Mon Feb 24, 2014 10:17 pm
Location: 127.0.0.1:9080
Contact:

Re: iframe content

Post 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?
kwandjeen
Posts: 6
Joined: Thu Oct 27, 2016 8:02 pm

Re: iframe content

Post 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.
Post Reply