Return-Path: X-Original-To: apmail-cordova-dev-archive@www.apache.org Delivered-To: apmail-cordova-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 64F90110D2 for ; Wed, 20 Aug 2014 11:58:36 +0000 (UTC) Received: (qmail 12586 invoked by uid 500); 20 Aug 2014 11:58:36 -0000 Delivered-To: apmail-cordova-dev-archive@cordova.apache.org Received: (qmail 12549 invoked by uid 500); 20 Aug 2014 11:58:36 -0000 Mailing-List: contact dev-help@cordova.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cordova.apache.org Delivered-To: mailing list dev@cordova.apache.org Received: (qmail 12536 invoked by uid 99); 20 Aug 2014 11:58:35 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 20 Aug 2014 11:58:35 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of mmocny@google.com designates 209.85.223.175 as permitted sender) Received: from [209.85.223.175] (HELO mail-ie0-f175.google.com) (209.85.223.175) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 20 Aug 2014 11:58:31 +0000 Received: by mail-ie0-f175.google.com with SMTP id x19so2602103ier.6 for ; Wed, 20 Aug 2014 04:58:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:content-type; bh=daemPXj+YYHD/DeIWhoTDzQRxuJVXysVtNzHo2zyZ1o=; b=TLDDCrl2kojYy5G8PQsSfVsDgy+Arkh5oceMIOTe6WuqIhbXojABMRSmpdc4ZSdqit d8Dp2kHfNHVGTYcg6Fn/D0r1AYXW5Tazia9D+5L2utDNswMFEbBcxg61ZwG0qmh1MBDs 03wjLHGlH/w1DsEZiZdD++q/l0GCBoyGTE5cpwPioiiZdJL/VIeUUs96f5jxdi3FjIVZ huLNoWbcRcY83CR2ou4bvals1udJZUksbqRTLf/dnYTIdgHXNV6tR2GuJScjtMf1QMBn fyzHfjywBex0Omr3bY1dU5Qm25orS8hJq8mDEEG3ShC3UEgobzNLGzHUFlB02pw6CevK GP/Q== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:content-type; bh=daemPXj+YYHD/DeIWhoTDzQRxuJVXysVtNzHo2zyZ1o=; b=bWoxobAQakbrsEiWqTe5RSpuLVVDugX6Iy0WMcCxiFsWKxuMq2h0isGPlCF7QqvGZM 3+IkzRSAgkWmXBma3SKHBN7znV4IukbOx2OGj9uJZu/NDD0S0fdAIs05iJlaNd1vN/ZI 4mbmd9hvp30+8nlUAfYtU9mARXcv4VLmiV9zk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:content-type; bh=daemPXj+YYHD/DeIWhoTDzQRxuJVXysVtNzHo2zyZ1o=; b=S+u2jOt30JcWEcyg0esQ08w/Qw6hP9sSXFXzClYtKsuSUO41CACtYbn+VuJlg8c/hI yvSvsiJqZcF4B9m+Po1oRo97fpFB8G1wKg7qaPeVO6cxQh9IMQKeet6FIhe5tCMkMBxr FErTbEbzge9pSibCwSCPiQcRFJ1X/4clTVoSShcZTsqXyUo6w8IyyRSK+BSBAiPbuJtF LxATTdDj+qcyjDN5dAdtW17j0WWGxvS+0BurigwzFupL0hUusAZrkIr19uE4kCTWgiz3 NtequsXOYFS9wd3vVI6oK6gOyLmfxXSBIXSrrCPgObfLYfqs9N6lbRACsUb4BDPScfEw XxSg== X-Gm-Message-State: ALoCoQnC36o9hFgo1xmnSJgpKQdc1IPzR0pjLwCuXmWuGKnCa/N/weRMmGaZPkNAmYiZJhB5X8wi X-Received: by 10.50.107.7 with SMTP id gy7mr12051943igb.15.1408535891029; Wed, 20 Aug 2014 04:58:11 -0700 (PDT) MIME-Version: 1.0 Sender: mmocny@google.com Received: by 10.64.59.168 with HTTP; Wed, 20 Aug 2014 04:57:50 -0700 (PDT) In-Reply-To: References: <53dbfa5d.e2f2440a.051e.ffff90b1@mx.google.com> <53dc7488.283e460a.7848.ffffbb10@mx.google.com> From: Michal Mocny Date: Wed, 20 Aug 2014 07:57:50 -0400 X-Google-Sender-Auth: caEdnfYDxA_N7NldAiOj_tRVBsU Message-ID: Subject: Re: remotely loaded pages To: dev Content-Type: multipart/alternative; boundary=e89a8ffbae4170767c05010e51f0 X-Virus-Checked: Checked by ClamAV on apache.org --e89a8ffbae4170767c05010e51f0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Make it available Ally, of course that sounds interesting! I'm sure a few of us have suggestions for improvements too. On Wed, Aug 20, 2014 at 2:38 AM, Ally Ogilvie wrote: > Marcel, Sorry for the late reply. > > For some games that I produce where the entire game is served to the clie= nt > (requires no .html in the application) we have a tool called "spellcaster= ". > Spellcaster handles internet connectivity, localisation and Cordova code > injection. It works as follows: > > One simply adds an application URL to Cordova's config.xml in src=3DYOUR_URL_HERE> > > - Spellcaster will check for an active internet connection. If one is not > found Spellcaster will continue retrying at a set interval. > - Spellcaster downloads the content of the provided application URL and > stores to application cache (overriding any existing loader). > - Spellcaster injects Cordova script tags just after the tag. > - Spellcaster loads the new *loader into the WebView > > *loader is your html to load. > > Are people still in need of such a solution? I could have this code made > public it just needs a public sanitise check. Spellcaster supports iOS an= d > Android. > For iOS it requires 1 line of code to be added to > didFinishLaunchingWithOptions. > For Android it requires these overrides in onCreate: > > @Override > public void onCreate(Bundle savedInstanceState) { > super.onCreate(savedInstanceState); > super.init(); > > @Override > public void init() { > Spellcaster spellcaster =3D new Spellcaster(); > spellcaster.init(this, Config.getStartUrl(), appView); > ... > > @Override > public void init(org.apache.cordova.CordovaWebView webView, > org.apache.cordova.CordovaWebViewClient webViewClient, > org.apache.cordova.CordovaChromeClient webChromeClient) { > super.init(webView, webViewClient, webChromeClient); > > Spellcaster spellcaster =3D new Spellcaster(); > spellcaster.init(this, Config.getStartUrl(), webView); > ... > > > On Sat, Aug 2, 2014 at 2:17 PM, purplecabbage > wrote: > > > It is great design for development, and netflix. > > > > Sent from my iPhone > > > > > On Aug 1, 2014, at 4:26 PM, Marc Weiner wrote= : > > > > > > It's technically possible, and even (arguably) legal according to > Apple's > > > documentation, depending on the nature of the code and how it's > > implemented: > > > > > > 3.3.2 An Application may not download or install executable code. > > > Interpreted code may only be used in an Application if all scripts, > code > > > and interpreters are packaged in the Application and not downloaded. > The > > > only exception to the foregoing is scripts and code downloaded and ru= n > by > > > Apple's built-in WebKit framework, provided that such scripts and cod= e > do > > > not change the primary purpose of the Application by providing featur= es > > or > > > functionality that are inconsistent with the intended and advertised > > > purpose of the Application as submitted to the App Store. > > > > > > However, I would only do so if the code is coming from a server that > you > > > control, and if you are able to control what code is getting executed= . > > > Loading in 3rd party, unverified scripts into your Cordova view is a > big > > > "no-no" for security reasons, and could get your app delisted (or > > rejected). > > > > > > If anyone else has more information on the topic, I'd be interested i= n > > > hearing it. > > > > > > Marc > > > > > > > > >> On Fri, Aug 1, 2014 at 7:01 PM, Victor Sosa > > wrote: > > >> > > >> Hi Frederico. > > >> > > >> While what you are saying about the policies stores is true, this > > applies > > >> to public stores only (as far as I can tell). For on-premise app > stores > > >> this might be false because each store owner need to set and apply t= he > > >> governance for the apps. It could end on horrible results due to a b= ad > > >> implementation. > > >> > > >> I concur with everyone, it is possible but awful design > > >> On Aug 1, 2014 4:35 PM, "Frederico Galv=C3=A3o" < > > >> frederico.galvao@pontoget.com.br> > > >> wrote: > > >> > > >>> I don't have the details in hand at the moment, but I remember seei= ng > > in > > >>> more than one application store last year policies being changed to > > >>> disallow remote code to run in an application on-demand. Such rules > > >> *could* > > >>> as well be applied to Cordova apps that load remote content > considered > > as > > >>> code (HTML isn't, but JS is). It's not only a security concern per > se, > > >> but > > >>> also an imposed limitation on the stores (which were obviously > created > > >> for > > >>> security concerns in the first place). > > >>> > > >>> Not even mentioning the issues with providing the right cordova.js > > >> version > > >>> from the remote server not really knowing where the request came > from. > > >>> However, it's good to note too that aside Phonegap Developer App, > there > > >> is > > >>> also Adobe Hydration that does the exact same thing as a side servi= ce > > to > > >>> Phonegap Build. I don't know if they've come into any of the issues > > >>> mentioned, and I haven't even heard of it being used in production. > > >>> > > >>> > > >>> 2014-08-01 17:36 GMT-03:00 purplecabbage : > > >>> > > >>>> I agree with all your statements Marcel. I use this approach > > frequently > > >>> in > > >>>> dev for fast turnaround. > > >>>> Ultimately App Store policies decide what can and cannot be done. > > >>>> > > >>>> Regarding security, there is nothing I can do with a remote page > that > > I > > >>>> can't already do inside my app. It's an issue of trust. > > >>>> > > >>>> > > >>>> Sent from my iPhone > > >>>> > > >>>>> On Aug 1, 2014, at 10:35 AM, Shazron wrote: > > >>>>> > > >>>>> I agree that it is not recommended, but it's possible. I delved > into > > >>>>> this question here: > > >>>>> https://github.com/shazron/phonegap-questions/issues/37 > > >>>>> > > >>>>> The PhoneGap Developer App is an example of how this is working a= t > > >>>>> http://app.phonegap.com but they do some proxying to get around > the > > >>>>> CORS limitations I believe. > > >>>>> > > >>>>>> On Fri, Aug 1, 2014 at 10:23 AM, Marcel Kinard < > cmarcelk@gmail.com> > > >>>> wrote: > > >>>>>> I've been getting occasional questions about users trying to use > > >>>> remotely-loaded (non-local) HTML pages with Cordova (in the webvie= w, > > >> not > > >>>> InAppBrowser), and still expecting to have access to the plugin AP= Is > > >>>> (camera is a popular one). My response so far is: "This is an > > >> unsupported > > >>>> configuration, because Cordova was not designed for this and the > > >>> community > > >>>> does no testing of this configuration. While it can work in some > > >>>> circumstances, it is not recommended nor supported." > > >>>>>> > > >>>>>> My definition of "unsupported" is not that it is incapable, but > that > > >>> we > > >>>> don't claim that it is supposed to work, and more importantly, we > > won't > > >>>> actively fix user-submitted defects on this topic. > > >>>>>> > > >>>>>> The main concern I have on this is same origin policy, and > matching > > >>> the > > >>>> remotely-served cordova.js with the locally-installed native Cordo= va > > >>>> platform to avoid version mismatch. > > >>>>>> > > >>>>>> Do you think I'm out in-the-weeds on this, or do you agree? > > >>>>>> > > >>>>>> If you agree, what would you think of a blurb in cordova-docs > > >>> somewhere > > >>>> that captures this gist? > > >>>>>> > > >>>>>> Thanks for your feedback! > > >>> > > >>> > > >>> > > >>> -- > > >>> > > >>> *Frederico Galv=C3=A3o* > > >>> > > >>> Diretor de Tecnologia > > >>> > > >>> PontoGet Inova=C3=A7=C3=A3o Web > > >>> > > >>> > > >>> ( +55(62) 8131-5720 > > >>> > > >>> * www.pontoget.com.br > > >> > > > > > > -- > Ally Ogilvie > Lead Developer - MobDev. | Wizcorp Inc. > ------------------------------ > TECH . GAMING . OPEN-SOURCE WIZARDS+ 81 (0)3-4550-1448 | Website > | Twitter | > Facebook > | LinkedIn > > --e89a8ffbae4170767c05010e51f0--