Joni de Campos
Posts: 0
Joined: Fri Dec 11, 2015 12:21 pm

Calling javascript funcion inside a iframe using HTML component - Blocked a frame with origin

I am trying to call a javascript function inside a iframe.

This is a test before to attempt to include a external geolocalization html code:

The HTML component calls the first iframe function ( iframe1.html) then calls the second iframe function( iframe2.html).

The link Do It calls the functions on the parent frame, iframe1 and iframe2.

When used inside the HTML component it calls the iframes, but when I trying to call the Do It link it does not work. Inspector shows the following error:

Localizador.html:1Blocked a frame with origin "http://appery.io" from accessing a frame with origin "http://www.is3d.com.br". Protocols, domains, and ports must match.

Here is the code inside the HTML Component

<!--

<html
<head
<script type="text/javascript"
function parent_function()
{
alert('parent');
}

function doit() {
parent_function();
document.getElementsByTagName('iframe')[0].contentWindow.iframe1_function();
document.getElementsByTagName('iframe')[0].contentWindow.document.getElementsByTagName('iframe')[0].contentWindow.iframe2_function();
}
</script
</head
<body
main
<a href="javascript:doit();"do it</a
<iframe src='http://www.is3d.com.br/clientes/guiap...'
</body
</html

--

----------------------------------------------------

This is the iframe1.html page Code:

<!--
<html
<head
<script type="text/javascript"
function iframe1_function() {
alert('iframe1');
}
</script
</head
<body
frame1
<iframe src='iframe2.html'
</body
</html
--

This is the iframe2.html code:

<!--
<html
<head
<script type="text/javascript"
function iframe2_function() {
alert('iframe2');
}
</script
</head
<body
frame2
</body
</html

--

Image

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

Calling javascript funcion inside a iframe using HTML component - Blocked a frame with origin

Hello Joni,

We are very sorry, but this is something outside the scope (http://devcenter.appery.io/support-po...) of our standard support.

Please look these topics which are related to your issue:
http://stackoverflow.com/questions/14...
http://stackoverflow.com/questions/25...

Joni de Campos
Posts: 0
Joined: Fri Dec 11, 2015 12:21 pm

Calling javascript funcion inside a iframe using HTML component - Blocked a frame with origin

Thanks for the fast reply.

I will take a look at the links you sent.

Return to “Issues”