0

How can I pull a picture out of iframe js. Without closing the iframe?

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="src/style.css">
        <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
  </head>
  <body>
    <iframe id="fff"><img src="https://urgi-stv.ru/wp-content/uploads/2/c/a/2ca07ff0390ccfd7fc4392f6c5416bbc.jpeg"/></iframe>
  <script>
  setInterval(() => {   
      $("#fff").contents().find("img") // ??
  }, 3000)
  </script>
  </body>
</html>
  • 1
    Your iframe code looks a bit strange: there shouldn't be any HTML elements inside your ` – Terry Feb 10 '23 at 09:21
  • Yeah, that's right. – user21170105 Feb 10 '23 at 09:23
  • Please read [ask]. Provide a real [mcve]. Tell us what you want to happen (I have several wildly different ideas about what "pull a picture of of iframe" might mean) and *what actually happens* (including any error messages that might be reported). – Quentin Feb 10 '23 at 09:24
  • Then you can only access the document in the iframe if and only if the iframe src is the same origin. – Terry Feb 10 '23 at 09:31

0 Answers0