0

I have an iFrame and have worked out how to clone it using jQuery:

<HTML> <HEAD> <SCRIPT type="text/javascript" src="jquery.js"></SCRIPT> <SCRIPT> function clone_test() { $('#FRAME1').clone().appendTo('#divtag'); } </SCRIPT> </HEAD> <DIV id="divtag"> <iframe id="FRAME1" name="FRAME1" src="http://currencies.typeit.org/" width="360" height="360" frameborder="0"></iframe> </DIV> <a href="javascript:clone_test()" target="FRAME1">- CLONE THE iFRAME -</a> </HTML> 

But this is not what I want! My problem is that anything typed in the currency box is not included in the cloning process. It seems only the HTML is cloned, not the actual contents of the iFrame. Is there anyway possible to clone the iFrame including anything typed in the currency box? This only has to work for the Chrome browser as I am making a Chrome extension.

0

4 Answers 4

2

If the Iframe from another domain, you cannot access its contents due to the Same Origin Policy.

Sign up to request clarification or add additional context in comments.

Comments

1

I don't think this is possible, your code just duplicates iframe element, which loads external page again, co it's in "default" state. But you cannot access content of iframe.

Comments

1

This cant be done when the url of the iframe and the url of your domain are not the same.

If they are the same you need to clone the document element of the iframe as well and append it to the cloned iframe.

Comments

0

There is a workaround for this though. Due to Same Origin Policy you need to use curl (if you are using php) to "fake" that the content is coming from the same domain. After which, you may be able to get the content of the iframe by using.

$("#frameid").contents().find("body *");

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.