Phonegap Build InappBrowser - What am I doing wrong?


i've been wrestling making calls cordova plugins within app. basically, i'm using phonegap wrapper load cms site. question has lots of sub-questions, please excuse me if take wandering approach.

 

i had planned on using inappbrowser - i'd support downloads (which seems inappbrowser not allow).

can load external site in iframe? looks iframes frowned upon due compatibility.

if try load external site through iframe, blank frame - suggests wrong whitelist.

here index.html. i'm using inappbrowser here (with location set no).

 

<!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >

<head>

    <title>emerald test app</title>

    <meta name="apple-mobile-web-app-capable" content="yes" />

    <meta name="viewport" content="width=device-width" />

    <script src="phonegap.js"></script>

</head>

 

 

<script type='text/javascript'>

 

    iabref = window.open('https://my-sites-url.com/content.aspx?page_id=31', '_self', 'location=no');

    iabref.addeventlistener('loadstart', iabloadstart);

    iabref.addeventlistener('loadstop', iabloadstop);

    iabref.addeventlistener('loaderror', iabloaderror);

    iabref.addeventlistener('exit', iabclose);

  

</script>

<body>

 

</body>

 

</html>

 

here's config

<?xml version="1.0" encoding="utf-8" ?>

<widget xmlns   = "http://www.w3.org/ns/widgets"

    xmlns:gap   = "http://phonegap.com/ns/1.0"

    id          = "com.my-site-url.testapp"

    versioncode = "5"

    version     = "1.0.4" >

 

  <name>test app</name>

 

  <description>

    app designed organization

  </description>

 

  <author href="https://www.my-site-url.com" email="support@clubexpress.com">

    app

  </author>

 

  <gap:platform name="ios" />

  <gap:platform name="android" />

  <gap:platform name="winphone" />

  <preference name="orientation" value="default" />

  <preference name="phonegap-version" value="cli-6.3.0" />

  <preference name="fullscreen" value="false" />

  <preference name="loadurltimeoutvalue" value="700000" />

  <preference name="loadingdialog" value="please wait, app loading"/>

  <preference name="allowinlinemediaplayback" value="true"/>

  <preference name="splashscreendelay" value="7000"/>

 

  <preference name="keeprunning" value="true"/>

 

  <icon src="res/icon/android-icon-36x36.png" gap:platform="android" gap:qualifier="ldpi" />

  <icon src="res/icon/android-icon-48x48.png" gap:platform="android" gap:qualifier="mdpi" />

  <icon src="res/icon/android-icon-72x72.png" gap:platform="android" gap:qualifier="hdpi" />

  <icon src="res/icon/android-icon-96x96.png" gap:platform="android" gap:qualifier="xhdpi" />

  <icon src="res/icon/apple-icon-57x57.png" gap:platform="ios" width="57" height="57" />

  <icon src="res/icon/apple-icon-72x72.png" gap:platform="ios"  width="72" height="72" />

  <icon src="res/icon/apple-icon-76x76.png" gap:platform="ios" width="76" height="76" />

  <icon src="res/icon/apple-icon-114x114.png" gap:platform="ios" width="114" height="114" />

  <icon src="res/icon/apple-icon-144x144.png" gap:platform="ios" width="144" height="144" />

  <icon src="res/icon/apple-icon-120x120.png" gap:platform="ios" width="120" height="120" />

  <icon src="res/icon/apple-icon-152x152.png" gap:platform="ios" width="152" height="152" />

  <icon src="res/icon/android-icon-72x72.png" gap:platform="webos" />

  <icon src="res/icon/android-icon-48x48.png" gap:platform="winphone" />

  <icon src="res/icon/apple-icon-180x180.png" gap:platform="winphone"   gap:role="background" />

 

  <gap:splash src="res/screen/default.png" />

  <gap:splash src="res/screen/default.png"  gap:platform="android" gap:qualifier="port-ldpi" />

  <gap:splash src="res/screen/mdpi.png" gap:platform="android" gap:qualifier="port-mdpi" />

  <gap:splash src="res/screen/hdpi.png" gap:platform="android" gap:qualifier="port-hdpi" />

  <gap:splash src="res/screen/xhdpi.png" gap:platform="android" gap:qualifier="port-xhdpi" />

  <gap:splash src="res/screen/xxhdpi.png" gap:platform="android" gap:qualifier="port-xxhdpi" />

  <gap:splash src="res/screen/xxxhdpi.png" gap:platform="android" gap:qualifier="port-xxxhdpi" />

  <gap:splash src="res/screen/default.png" gap:platform="ios"     width="320" height="480" />

  <gap:splash src="res/screen/640x960.png" gap:platform="ios"     width="640" height="960" />

  <gap:splash src="res/screen/640x1136.png" gap:platform="ios"     width="640" height="1136" />

  <gap:splash src="res/screen/750x1334.png" gap:platform="ios"     width="750" height="1334" />

  <gap:splash src="res/screen/768x1024.png" gap:platform="ios"     width="768" height="1024" />

  <gap:splash src="res/screen/1242x2208.png"  gap:platform="ios"     width="1242" height="2208" />

  <gap:splash src="res/screen/default.png" gap:platform="winphone" />

 

 

 

  <gap:plugin name="cordova-plugin-camera" spec="0.3.6" source="npm" />

  <gap:plugin name="cordova-plugin-media-capture" spec="1.0.1" source="npm" />

  <gap:plugin name="cordova-plugin-device" source="npm" />

  <gap:plugin name="cordova-plugin-device-orientation" source="npm" />

  <gap:plugin name="cordova-plugin-device-motion" source="npm" />

  <gap:plugin name="cordova-plugin-file" source="npm" />

  <gap:plugin name="cordova-plugin-file" source="npm" />

  <gap:plugin name="cordova-plugin-file-transfer" source="npm" />

  <gap:plugin name="cordova-plugin-media" spec="0.2.16" source="npm" />

  <gap:plugin name="cordova-plugin-inappbrowser"  source="npm" />

  <gap:plugin name="cordova-plugin-globalization"  source="npm"/>

  <gap:plugin name="cordova-plugin-dialogs" source="npm" />

  <gap:plugin name="cordova-plugin-vibration" spec="1.2.0" source="npm" />

  <gap:plugin name="cordova-plugin-whitelist" source="npm" />

<allow-navigation href="*" />

<allow-intent href="*" />

<access origin="*" />

<allow-navigation href="http://*.my-site-url.com" />

</widget>

 

 

if downloading , saving not available through inappbrowser, how can manage save files external site (that want native application)?

on external site, i've tried opening files using things like

window.open(url, '_system');

and _blank, , adding 'location=no' etc, no dice. presumably because pages open in inappbrowser sandboxed.

 

so - there way initiate download within external web page in inappbrowser using javascript?

is option modify onappbrowser plugin java file? seems sketchy , examples seem support ios.

 

should use iframe? ideas why iframes blank using above configuration? doing wrong?

 

if you've read far, reading!

several wrongs, here:

 

1. can't invoke inappbrowser plugin 'window.open()'. instead, should use plugin's interface, e.g. cordova.inappbrowser.open(). see plugin's docs: cordova-plugin-inappbrowser

 

2. if did correctly, wouldn't work, because not waiting deviceready event fire. plugins activated upon event.

see events - apache cordova

 

3. (not related:) in config, can remove (2 occurrences of !!) file plugin, integrated in file transfer plugin. also, should refrain using gap: namespace, now.

see icons , splash | phonegap docs

 

4. please note, stores reject apps merely website wrappers.

just curious: why such thing, if users have better app display website (called: browser). browser handles html/script better, offers more functionality (bookmarks, search) , present, anyway. serving website means wouldn't have trouble you're having now, , wouldn't have maintain , update 'app'.

see instance: app store review guidelines - apple developer

 

5. having said this: mean "support downloads"?

everything coming remote source 'downloaded'. if want display external content (like pdf document), create hyperlink document , download , display. if don't want display, why want downloaded?

if still required, done using ajax/xhr or file transfer plugin. latter not active content inside inappbrowser window.

 

6. html code doesn't show defined iab callback functions, iabloadstart, iabloadstop.

what should these functions do?



More discussions in PhoneGap


adobe

Comments

Popular posts from this blog

Illustrator CS6 Ocurrío un error E/S en el archivo.

Why is os_ViewContainer running?

Animate - problem with duplicating scripts after loop