Software Archive
Read-only legacy content
17060 ディスカッション

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

Leon_B_1
ビギナー
2,166件の閲覧回数

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 件の賞賛
16 返答(返信)
Swati_S_Intel1
従業員
2,166件の閲覧回数

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

 

Leon_B_1
ビギナー
2,166件の閲覧回数

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>

Swati_S_Intel1
従業員
2,166件の閲覧回数

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

sergio_g_
ビギナー
2,166件の閲覧回数

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

sergio_g_
ビギナー
2,166件の閲覧回数

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....)

Swati_S_Intel1
従業員
2,166件の閲覧回数

Hello Sergio/Leon,

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

Thanks,

Swati

Leon_B_1
ビギナー
2,166件の閲覧回数

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

Swati_S_Intel1
従業員
2,166件の閲覧回数

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. 

Leon_B_1
ビギナー
2,166件の閲覧回数
Already did it Not working too For me, ajax is fine, iframe is dead
John_H_Intel2
従業員
2,166件の閲覧回数

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

Chris_P_Intel
従業員
2,166件の閲覧回数

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.

Swati_S_Intel1
従業員
2,166件の閲覧回数

@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

 

Leon_B_1
ビギナー
2,166件の閲覧回数

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"

Swati_S_Intel1
従業員
2,166件の閲覧回数

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 

Yuriy_T_
ビギナー
2,166件の閲覧回数

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?

Swati_S_Intel1
従業員
2,166件の閲覧回数

@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.

返信