Note that there are some explanatory texts on larger screens.

plurals
  1. POGetting contents of dynamic Iframe
    primarykey
    data
    text
    <p>I am trying to get the contents of a dynamically generated Iframe (same-domain). I have this so far.</p> <pre><code> var frame = $('#avacweb_chat iframe'); var time = $('.date-and-time' , frame.contents()).last().attr('title'); var getTime = setInterval(function() { var newTime = $('.date-and-time , frame.contents()').last().attr('title'); },500); </code></pre> <p>I tried lines 1 and 2 together with an alert of <code>time</code> to see if I was actually grabbing the data. Though I am not. Basically what I want to do is get the last message <code>.data-and-time</code> and with the setInterval get the same thing.</p> <p>If they are different do something.</p> <p>This is how I believe my code will be set up once i get the data</p> <pre><code> var frame = $('#avacweb_chat iframe'); var time = $('.date-and-time' , frame.contents()).last().attr('title'); var getTime = setInterval(function() { var newTime = $('.date-and-time , frame.contents()').last().attr('title'); },500); if(time === newTime) { alert(); } </code></pre> <p>Any suggestions on grabbing data from iframe?</p> <p>Also tried=</p> <pre><code>var frame = $('#avacweb_chat iframe'); var time = $(frame).contents($('.date-and-time')); alert(time.length); </code></pre> <p>Which I get 1 which is correct</p> <p>Then I tried</p> <pre><code>var frame = $('#avacweb_chat iframe'); var time = $(frame).contents($('.date-and-time').attr('title')); alert(time); </code></pre> <p>Which becomes <code>[object Object]</code></p> <p>Working code =</p> <pre><code> var frame = $('#avacweb_chat iframe'); var time = $('.date-and-time' , frame.contents()).last().attr('title'); var newTime = setInterval(function() { var newT = $('.date-and-time' , frame.contents()).last().attr('title'); },500); if(time !== newT) { alert('New Message'); } </code></pre> <p>Now my question would be how do I get the newTime store it and then compare them?</p>
    singulars
    1. This table or related slice is empty.
    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