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> 
4
  • 1
    Your iframe code looks a bit strange: there shouldn't be any HTML elements inside your <iframe> element, and it's missing a src attribute. I supposed you mean you want to have access to an image from the document rendered in an iframe element? Commented Feb 10, 2023 at 9:21
  • Yeah, that's right. Commented Feb 10, 2023 at 9:23
  • Please read How to Ask. Provide a real minimal reproducible example. 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). Commented Feb 10, 2023 at 9:24
  • Then you can only access the document in the iframe if and only if the iframe src is the same origin. Commented Feb 10, 2023 at 9:31

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.