0

I'm trying to retrieve the track_artist_name and cue_title from a url used by a radio station to show the song being played. I am using an iFrame to detour the "Same-Origin-Policy" by select/copy the text displayed but the console says: Uncaught TypeError: copyText.select is not a function Does anyone has another idea on how can I get the data ? Thank you : )

<html>
<body>

<iframe src="http://np.tritondigital.com/public/nowplaying?mountName=XERC_FM&numberToFetch=1" height="200" width="500" title="Iframe Example" id="frame" allow="clipboard-read; clipboard-write"></iframe>

<button onclick="myFunction()">Copy text</button>

<script>
function myFunction() {
  var copyText = document.getElementById("frame");
  copyText.select();
  copyText.setSelectionRange(0, 99999);
  document.execCommand("copy");
  alert("Copied the text: " + copyText.value);
}
</script>

</body>
</html> ```
Ren
  • 1
  • 1
    A policy related to the Same-Origin Policy will prevent your page from getting access to the content of a frame loaded from a different domain. – Pointy Aug 02 '21 at 12:46
  • You will need to write a proxy - this may violate the target's [TOU](https://www.tritondigital.com/terms-of-use): _Any and all content, data, graphics, photographs, images, audio, video, software, trade-marks, service marks, trade names and other information (collectively, the “Content”) contained in this Site are the property of Triton and/or its Affiliates. Except as set forth herein, you may not copy, modify, reproduce, publish post, transmit, distribute, display, create derivative works from, or sell the Content without the express written permission of Triton._ – mplungjan Aug 02 '21 at 12:47

0 Answers0