I'm rendering an iframe from a different domain. The iframe contains scripts only (e.g. ).
Is there a way to extract the contents of the said iframe or at least the last script tag inside that iframe?
I have tried console.log($("iframe").contents().find('script'));
but this return a length of 0 and so there were no script extracted.
UPDATE:
<script type="text/javascript" src="/jwplayer/jwplayer.js"></script>
<script type="text/javascript">jwplayer.key="KEYHERE";</script>
<div id='videoPlayer'></div>
<script type='text/javascript'>
jwplayer('videoPlayer').setup({
file: 'VIDEO LOCATION HERE',
autostart: "true",
width: "100%",
height: "100%",
image: "IMAGE LOCATION HERE"
});
</script>
This is what the iframe HTML looks like. My actual goal here is to extract the last script on the iframe so I can replace the file being rendered on certain conditions.