Software Archive
Read-only legacy content
17061 Discussions

Build 1826 - no iframe, no ajax on cordova 4.1.2 Android

Leon_B_1
Beginner
1,254 Views

XDK v1826

Cordova 4.1.2

Android Build

 

Ajax does't work

iframe does't work

Only on Android (iOS and WP works)

 

But if I use Cordova 3.5, it works

 

Tested on Windows 10 Technical Preview  v10041, on March 25

Tried on MAC OSX Yosemite too, same error

0 Kudos
16 Replies
Swati_S_Intel1
Employee
1,254 Views

Hello,

Are you using Cordova Android Build? Which device are you testing on?

Ajax works just fine on Android with Cordova 4.1.2 using Cordova Android build.

Please make sure under the Project Build Settings you put * in the Domain List to allow your app to access other domains. If that doesn't work try the attached sample Ajax project and let me know if it works for you. 

Swati

 

0 Kudos
Leon_B_1
Beginner
1,254 Views

I can confirm the bug,

access = *, and Corova Build (not legacy)

If I just change cordova from 4.1.2 to 3.5, and build, it works

tested on Galaxy Tab 2 with cyanogenmod/lollipop android 5.0.2, and on Moto X 2014 with android 5.0 (unchanged, no root)

 

the same happens to <iframe>

<iframe> on 4.1.2 does not load src page

but if I change to cordova 3.5, it works

 

Only on Android (iOS and WP works on 4.1.2)

 

my ajax:

$.ajax({
        type: "GET",
        url: "http://mandrillapp.com/api/1.0/messages/send.json",
        data: {
            'key': 'xxxxxxxxxxxxxxxxxxx',
            'message': {
                'from_email': 'xxxxxxxx@gmail.com',
                'to': [
                    {
                        'email': 'yyyyyyyy@gmail.com',
                        'name': 'RELPREV',
                        'type': 'to'
                    },
                    {
                        'email': 'zzzzzzzzz@gmail.com',
                        'name': 'RELPREV',
                        'type': 'to'
                    }
                ],
                'autotext': 'true',
                'subject': 'RELPREV   ' + window.document.getElementById("q6").value + '   ' + reformatDate(window.document.getElementById("q4").value),
                'html': '' +
                '<B>RELPREV/ASR</B>  ' + window.document.getElementById("q6").value + '   ' + reformatDate(window.document.getElementById("q4").value) +
                '<br>------------------------------------------------------------------------------------<br>' +
                '<B>LOCAL: </B>' + window.document.getElementById("q3").value +
                '<BR><BR><B>DATA: </B>' + reformatDate(window.document.getElementById("q4").value) +
                '<BR><BR><B>HORA: </B>' + window.document.getElementById("q5").value +
                '<BR><BR><B>PESSOAL ENVOLVIDO E/OU AERONAVE: </B>' + window.document.getElementById("q6").value +
                '<BR><BR><B>SITUAÇÃO: </B>' + window.document.getElementById("q7").value +
                '<BR><BR><B>TELEFONE: </B>' + window.document.getElementById("q8").value + 
                '<BR><BR><B>EMAIL: </B>' + window.document.getElementById("q9").value +
                '<BR><BR><B>RELATOR: </B>' + window.document.getElementById("q10").value + '<br>------------------------------------------------------------------------------------'
            }
        }
    });

 

my iframe:

<iframe id="foo"
        src="http://www.crea-am.org.br/src/site/noticia.php?echoMiolo=1"

        frameborder="0"


        style="overflow: hidden; width: 100%; min-height: 100% ; top: 0px; left: 0px;"
        onload="document.getElementById('loadImg').style.display='none';"
        >
</iframe>

0 Kudos
Swati_S_Intel1
Employee
1,254 Views

Currently I don't have a device with Android 5.0 to test on. Can you please try the sample app I provided and confirm the issue?

Thanks,

Swati

0 Kudos
sergio_g_
Beginner
1,254 Views

I confirm this problem with the iframe.

I use intel xdk 1826 and cordova 4.1.2

In the emulate tab and even App preview, the iframe works but after building the app and testing it in my smarphone, the iframe doesn't work.

My smartphone uses the Android version 4.1.1

0 Kudos
sergio_g_
Beginner
1,254 Views

Even with the new version (1878), the iframe doesn't work. As I said before, it works in the emulate tab and App Preview but not with the finished app. I've got a message like that when the app starts : Application error (internet error....)

0 Kudos
Swati_S_Intel1
Employee
1,254 Views

Hello Sergio/Leon,

If ajax is still not working for you please send me your .apk file so we can debug.

Thanks,

Swati

0 Kudos
Leon_B_1
Beginner
1,254 Views

the problem is back in part

 

now we have no iframe, neither with cordova 3.5, nor 4.1.2

neither in app preview, nor on builded app .apk

 

ajax is working in 3.5 (I didn't tested on 4.1.2)

 

tested on XDK 1995, Elementary OS (ubuntu 14.04 x64), kernel 4.0

0 Kudos
Swati_S_Intel1
Employee
1,254 Views

Please read this article on how to use the build settings with Cordova CLI 4.1.2 in order for an app to allow access to other domains and launch external applications. 

0 Kudos
Leon_B_1
Beginner
1,254 Views
Already did it Not working too For me, ajax is fine, iframe is dead
0 Kudos
John_H_Intel2
Employee
1,254 Views

Instead of iframe, have you tried using the InAppBrowser plugin to display the remote content?

0 Kudos
Chris_P_Intel
Employee
1,254 Views

Isn't this just the domain whitelisting problem?  https://software.intel.com/en-us/articles/cordova-cli-412-domain-whitelisting-with-intel-xdk-for-ajax-and-launching-external-apps

 

My apologies if this has been suggested already.

0 Kudos
Swati_S_Intel1
Employee
1,254 Views

@Leon, what URL are you trying to access in an iframe? There are certain sites that do not allow access through iframes (for example, google.com). The best way to access those URLs is to use inAppBrowser plugin. You can use : 

window.open('http://YourURL', '_blank', '');

Let us know if that doesn't work.

Swati

 

0 Kudos
Leon_B_1
Beginner
1,254 Views

OK tested

It really was the site's fault, not xdk

I've tried another site, and worked, BUT ONLY ON Cordova 3.5

Cordova 4.1.2 opens NO SITE on iframe

this link below works on 3.5, but not on 4.1.2

src="http://www.crea-am.org.br/src/site/noticia.php?echoMiolo=1"

0 Kudos
Swati_S_Intel1
Employee
1,254 Views

Hi Leon,

This link you mentioned works fine with CLI 4.1.2. Did you put * in the Domain list? Which device are you testing on? 

Swati 

0 Kudos
Yuriy_T_
Beginner
1,254 Views

Hi, all!

I'm trying to resolve same trouble on my android 4.1.1 version smartphone by article "Cordova CLI 4.1.2 Domain Whitelisting with Intel XDK for AJAX and Launching External Apps", but nothing works!!!

No ajax and no iframe to external domains when tested build, but works fine in App Preview and Emulate...

XDK ver 2248.

Any new ideas?

0 Kudos
Swati_S_Intel1
Employee
1,254 Views

@Yuriy T., which domain(s) are you trying to access via ajax and iframe? Can you send the snippet of your code? Are you using Android Cordova build? Also if possible send a screenshot of your Project>Build Settings page.

0 Kudos
Reply