chantouchsek / vue-iframes

A Vue js component for creating super fast loading, non-blocking iframes.
48 stars 4 forks source link

access iframe content #7

Closed eli007s closed 3 years ago

eli007s commented 3 years ago

when running

this.iframe = frame.contentWindow this.iframe.document.body.innerHTML

it returns

<script>
  window.document.onreadystatechange = function () {
    if (window.document.readyState === 'complete') {
      parent.postMessage('IFRAME_ON_READ_STATE_CHANGE_12f03cf2-9d09-4430-8e2e-8d88c60408ac', '*')
    }
  };
</script>

what needs to be done to return the content of the loaded iframe?

Chantouch commented 3 years ago

@eli007s so do you want to access html content ?

github-actions[bot] commented 3 years ago

Stale issue message

gilfuser commented 3 years ago

Hi there! Do you mind reopen this issue? Well, it's not really an issue, is more a how-to.

I would like to access the css classes in the html inside the iframe, but couldn't find a way to do it. I'm fiddling inside the onload(frame) as @eli007s.

My goal is to remove a div in the html, selecting it through its class, but it should work to change or add a style.

best regards, Gil

edit: @Chantouch : just mentioning you to bring your attention to this edit 2: love old cambodian rock n' roll, b.t.w.

chantouchsek commented 3 years ago

what is the plan to remove a div inside html element ?

TouchSek commented 3 years ago

@gilfuser did you try to access it by $refs?

gilfuser commented 3 years ago

Hi @Chantouch. Yes, I did.

chris-aeviator commented 3 years ago

shouldnt browsers disallow access to iframe content by default?

TouchSek commented 3 years ago

@chris-aeviator yes, it might be so too.