Extracting URL from iframe src value

I want to extract a link which is in the src attribute in an iframe. I’m new to javascript so I’m not entirely sure that I’ve got the description right, if not, please correct me. This is my javascript code for a chrome extension:

document.addEventListener('DOMContentLoaded', function() {
  var checkPageButton = document.getElementById('copyClip');
  checkPageButton.addEventListener('click', function() {

    chrome.tabs.getSelected(null, function(tab) {
      var getUrl = document.getElementsByTagName("iframe");
      for(i=0; i< getUrl.length; i++){
        window.prompt("output", getUrl[i].src);
      }
    });
  }, false);
}, false);

This should prompt me with the content of src=""

The element I want to access is:
<iframe src="http://thevideos.tv/embed-jho7vvhbiczp-728x410.html" webkitallowfullscreen="true" mozallowfullscreen="true" allowfullscreen="true" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" width="728" height="410"></iframe>

function getSrc(){
  var checkPageButton = document.getElementById('copyClip');
  checkPageButton.addEventListener('click',function(){
  var getUrl = document.getElementsByTagName("iframe");
  var url=[];
  for(var i=0;i<=getUrl.length;i++){
  url[i]=getUrl[i].src;
  }
  });
}

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.