Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6933333
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T11:49:10+00:00 2026-05-27T11:49:10+00:00

I would like to copy images from a iframe into a textarea. The pages

  • 0

I would like to copy images from a iframe into a textarea. The pages and the iframe are not on the same domain or server.

Any ideas on how to achieve this using javascript?

The iframe with images is using ajax to collect images.

Usage:

For example I would like to use this method to copy images from a iframe into the tinymce text-editor of wordpress. Eg. display a iframe with a image gallery under the text-editor, and when they click on the image in the iframe the image should display in the text-editor (the image is alredy uploaded).

Some ideas:

Drag and drop the images seams to work in IE and FF.

Rightclick, copy and past images seams to work in IE and C.

It would be nice if I could get the src of the image in a variable, to be able to add “class” and “alt”.

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Copy images from iframe</title>
</head>

<body>

<textarea style="width:100%;height:400px" >I want to be able to get theme here like this
<img src="http://www.page.com/image.jpg" alt="">
</textarea>

<iframe width="100%" height="400px" src="http://www.page-with-images.com/"></iframe>

</body>
</html>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T11:49:11+00:00Added an answer on May 27, 2026 at 11:49 am

    Try using jQuery.

    Add a click event to $("iframe img"). In the click function, get the image’s src and append that as an image tag to the tinyMCE editor.

    This would look something like this:

    $(function(){
        $("iframe img").click(function(){
            var update = $("<div>").append(
                $("<img>").attr("src", $(this).attr("src"))
            ).html();
    
            $("#content").val(function( i, v ) {
                return v + update; 
            });
        });
    });
    

    Example..

    We’re pretty much cloning the image, placing it in a temporary div, getting the pure HTML content of the div (so that we convert the image object to a usable string), and updating the textarea’s value with it. Of course, in the demo I linked, #fake is the equivalent of an iframe in this case.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to copy an array of pixel data (colors) into a texture.
I would like to copy a macro from one Excel workbook to another using
I would like to export my code from the working svn copy while including
I would like copy just file.xml without folder structure using overlays like this: <overlays>
I would like to copy stdout and stderr of my Perl script to a
I would like to copy to clipboard what a Control of my WPF app
I would like to copy one object to another object, and the fields with
I would like to copy whole directory to another directory. xcopy and My.Computer.FileSystem.CopyDirectory only
I have a Visual Studio 2008 C++ project where I would like to copy
I would like to prevent copy, cut and paste in my TEdit . How

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.