Note that there are some explanatory texts on larger screens.

plurals
  1. POjQuery – Parse iframe inserted after page load
    primarykey
    data
    text
    <p>I'm new to jQuery and having some trouble. A have a page that has a <code>iframe</code> inserted after the page loads. I need to find the anchor links in the content of the <code>iframe</code> and compare their <code>href</code> to a URL. Just trying the pure JavaScript <code>getElementById()</code> doesn't work because the <code>iframe</code> is inserted after the load. I read that I should be using either jQuery's <code>live()</code>, <code>delegate()</code>, or <code>on()</code>, but I'm not sure how they work. Also, if there is a pure Javascript solution that would be awesome as well.</p> <p>The <code>iframe</code> I need to parse is:</p> <pre><code>&lt;iframe src="http://assets.tumblr.com/iframe.html?10&amp;src=http%3A%2F%2Fstaff.tumblr.com%2F&amp;amp;lang=en_US&amp;amp;name=staff" scrolling="no" width="330" height="25" frameborder="0" style="position:absolute; z-index:1337; top:0px; right:0px; border:0px; background-color:transparent; overflow:hidden;" id="tumblr_controls"&gt; &lt;/iframe&gt; </code></pre> <p>It is appended to every Tumblr blog (see <a href="http://staff.tumblr.com" rel="nofollow">Tumblr Staff Blog</a>).</p> <p>The part of the iframe's content I'm interested in looks like:</p> <pre><code>&lt;div style="position:absolute; top:3px; right:3px; white-space:nowrap; height:20px;"&gt; &lt;form action="/follow" method="post" style="display:block; float:left;" onsubmit="_gaq.push(['_trackEvent', 'Iframe', 'Follow', 'staff');"&gt; &lt;input type="hidden" name="form_key" value="8W0r1XnbOEtpTF0q8oe96BmGMJg"/&gt; &lt;input type="hidden" name="id" value="staff"/&gt; &lt;input type="image" src="http://assets.tumblr.com/images/iframe_follow_alpha.png 1018" style="width:58px; height:20px; border-width:0px; display:block; margin-left:3px; cursor:pointer;" alt="Follow"/&gt; &lt;/form&gt; &lt;a target="_top" href="http://www.tumblr.com/dashboard"&gt; &lt;img src="http://assets.tumblr.com/images/iframe_dashboard_alpha.png?1018" alt="Dashboard" style="height:20px; width:81px; border-width:0px; display:block; float:left; cursor:pointer;"/&gt; &lt;/a&gt; </code></pre> <p></p> <p>I need to compare all the possible anchor links in this content and compare their hrefs to a URL.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload