javascript - Get all elements inside iframe tag -
this part of code i'm using iframe tag , loaded epub on iframe tag don't know how elements inside iframe tag.
jquery(document).ready(function($) { var tmp = $('#epub_loader iframe').contents().find('body').html(); alert(tmp); });
<iframe id="epub_loader" href="test.epub" ></iframe>
`
assuming both frames on same domain , there no restriction same domain policy, can use following code "parent" frame element in "child" iframe (in case body
tag).
pseudo code, need point iframe dom id:
var html = document.getelementbyid('iframe').contentdocument.body.innerhtml;
notes: in case iframe on different domain, have limited access browser security reasons.
Comments
Post a Comment