Fill in the inputs of an iframe

0

Good afternoon. I would like to know if it is possible to populate iframe inputs through JavaScript.

<iframe src="http://frame.com"width="100%" height="800" id="frame"></iframe>

I know the input name of the iframe and thought about it:

<script type="text/javascript">
function myFrame() {
    $("input[name='txt_nm_requerente']").val("fernanda");
};

But it did not work.

    
asked by anonymous 13.01.2016 / 16:20

1 answer

0

Fernanda, unfortunately you will fall from the security policy of browsers, which will not allow you to modify a document in a different domain or access it using AJAX.

For you to work around this, you would have to change a header in the url of the city, in this case the allow-cross-origin , but I believe you do not have access to it.

You can use a Proxy to attempt to counter this security policy, such as http://crossorigin.me/ , but may not have the expected result.

    
13.01.2016 / 16:37