1.3-beta.11 / iOS / iFrame / <allow-navigation> / App.accessRule


#1

I have an application running fine with Meteor 1.2.1 / Cordova. Both iOS and Android devices and simulators work as expected. The application is leveraging the Braintree drop-in UI for payment processing.

From a security perspective, the application is using both App.accessRules and BrowserPolicy

I upgraded the application to Meteor 1.3-beta.11, did some testing, and ran into an issue with iOS. The Braintree drop-in UI was not working properly and I was receiving the following in the logs:

ERROR Internal navigation rejected - not set for url=‘https://assets.braintreegateway.com/dropin/2.15.4/inline-frame.html#

The above made sense given the changes to Cordova and the new version of Cordova-iOS / WKWebView. The Braintree drop-in UI uses iFrames and it was not able to access properly.

I was able to address the issue by adding the following to the Cordova config.xml.

<allow-navigation href="https://*.braintreegateway.com" />

The question: With Meteor 1.3, should the mobile.config processing (App.accessRule or other) be enhanced to provide support for the above situation?

Thanks for your thoughts and considerations.


Meteor app won't load properly. Displays white screen
#2

Thanks for this. Is there another way to do this with the 1.3 release?


#3

Meteor 1.3 supports additional options for App.accessRule in mobile-config.js, so you would do:

App.accessRule('https://*.braintreegateway.com', { type: 'navigation' } );

#4

Thanks. I had tried that but got the syntax wrong. I had tried "App.accessRule('https://*.braintreegateway.com', 'navigation' );

My be good to have an example in the doc, pls


#5

BTW, is there anything related that would prevent a modal / iFrame from Filepicker.io ?

The have an option that shows their iFrame in a modal or opens a new window. This worked fine pre 1.3 so was thinking it may have something to do with WKWebView (BTW, the Filepicker modal opens perfectly on IOS Safari).

For that issue I see nothing in the console, unlike when I got an error when trying to open a URL related to the above issue.


#6

Hmmm, I’ve never used filepicker.io, so without an error it is hard to diagnose what might be going on. When you say you don’t see anything in the console, do you mean the Safari remote debugging console?


#7

I don’t see anything in the Safari remote debugging console or the Xcode console.

For example,I put a console.log before and after the call to Filepicker and they show in the remote debugging console. …nothing inbetween in the or the Xcode console.


#8

Hi @martijnwalraven any further thoughts pls? I replicated the issue just using the NPM package https://github.com/filepicker/filepicker-js

Any chance you can see something in here that would cause it to die (with no error ) on Cordova/WekWebView???

I have a call into Filepicker/Filestack too but no joy there yet.


#9

Could you create a Meteor project with a minimal reproduction?


#10

Hi @martijnwalraven here goes - https://github.com/Buzzy-Buzz/iOS-test-Filepicker-Debug

You’ll need to create a free Filestack/picker account and then substitute in your Filepicker/filestack here https://github.com/Buzzy-Buzz/iOS-test-Filepicker-Debug/blob/master/client/main.js#L13

cheers
Adam


#11

When I try your project, I get these errors in the Xcode console:

2016-04-04 08:43:10.666 iOS-test-Filepicker-Debug[20623:1137666] ERROR Internal navigation rejected - <allow-navigation> not set for url='https://dialog.filepicker.io/dialog/comm_iframe/'
2016-04-04 08:43:10.666 iOS-test-Filepicker-Debug[20623:1137666] ERROR Internal navigation rejected - <allow-navigation> not set for url='https://www.filepicker.io/dialog/comm_iframe/'

Your mobile-config.js uses type: 'intent' for the App.accessRule settings for these URLs, but these should be type: 'navigation' to allow loading within an iframe. Making this change, the filepicker does show and things seem to work.


#12

Awesome thanks!!!.. Weird as I thought I’d tried all the variants. That works!!!
Weird thing is I could not see that error in the Xcode console. Perhaps I am looking in the wrong place as I could see the message I logged with console.log but not those issues.


#13

Hmmm, it should be the other way around :slight_smile: By Xcode console, I mean the debug console within Xcode.


#14

Also having a similar issue, however mine is the following:

ERROR: Start Page at 'www/index.html' was not found.
ERROR Internal navigation rejected - <allow-navigation> not set for url='about:blank'

The app is actually not progressing past the splash page as a result of this, any thoughts @martijnwalraven ?

Cheers


#15

@ryenbeatty: Did you override config.xml by any chance?


#16

Yes I did actually, I tried to insert the following line to negate the error:

  <allow-navigation href="about:blank" />

Should I use default config.xml instead?


#17

Yes, overriding config.xml is a bad idea in general, because it means you lose all the configuration set by the build process and by installed plugins. In this case, your error occurs because it is trying to load the default Cordova start page instead of loading from the Meteor local file server.


#18

Righto, thanks so much for clarifying, I’ll give that a go :slight_smile:


#19

FYII am seeing that in the Xcode console too:

Buzzy[34678:11878782] ERROR Internal navigation rejected - <allow-navigation> not set for url='http://staticxx.facebook.com/connect/xd_arbiter.php?version=42#channel=feb08aadc&origin=http%3A%2F%2Flocalhost%3A12456'
2016-04-04 19:07:21.785 Buzzy[34678:11878782] ERROR Internal navigation rejected - <allow-navigation> not set for url='about:blank'
2016-04-04 19:07:21.844 Buzzy[34678:11878782] Error syncing to server time:  Error: network
2016-04-04 19:07:21.844 

I did add

App.accessRule('https://*.facebook.com/*', { type: 'navigation' } );

That said the filepicker issue seems to be resolved. I think I had multiple App.accessRule's in my mobile-config as I was trying stuff and it seems like last one wins.


#20

@martijnwalraven Not overriding config.xml fixed that issue, however when I actually run the app, it is stuck on the splash screen (no errors in xcode console), and the Safari inspector only registers an about:blank target, rather than the usual index.html. Any thoughts would be very much appreciated.

UPDATE: Just tested with brand new meteor create project, with the same result. Leads me to think the issue is potentially with XCode