On IOS (a polyfilled browser), the web components polyfill loads html imports using XHR. This means that from a webview, they're loaded from file:///, which is typically blocked by browsers/environments for security reasons.
Unsure if there's an equivalent in ios, but in android webview, you can override this setting: https://www.polymer-project.org/0.5/articles/webview.html#tweaking-the-webview-settings The other option is to vulcanize your entire app (vulcanize index.html -o index.v.html) which removes all import requests. On Mon, May 2, 2016 at 12:10 PM Jim Trainor <[email protected]> wrote: > am about to revisit this in depth… but… the last time I dug in there was > definitely an XHR load of an html file originating from polymer (from the > web component.min.js, actually, as I recall, which I am classifying > generically as “polymer”). > > As I recall the XHR request was loading html web components from its host > (I think it was loading the entire vulcanized html file). If that host url > happens to be file:// then that is what it used for the XHR request. The > problem is… WKWebView rejects that access… so no-go for the Polymer app. > > If the page is loaded via an ordinary http request then all is well. The > exact same code loading via an Android WebView is fine also. The problem > is limited to security restrictions in WKWebView. See the bug link that I > posted for more info. > > On Mon, May 2, 2016 at 12:34 PM, Karl Tiedt <[email protected]> wrote: > >> Nothing in polymer appears to reference file:// anything... this sounds >> like it may be a Cordova issue? >> >> -Karl Tiedt >> >> On Mon, May 2, 2016 at 9:17 AM, Jim Trainor <[email protected] >> > wrote: >> >>> Polymer applications fail to load in an iOS WKWebView, as supported by >>> Cordova. The root cause of the problem is that WKWebView does not permit >>> loading of content via file:. Cordova's support for WKWebView bypasses >>> this restriction by implementing a in-app web server to host the static >>> content. Polymer fails because the polymer code tries to load a local, >>> static, html file, using a file:// url via an XHR request. The file:// XHR >>> request is rejected by WKWebView. >>> >>> This has turned into a blocking issue for publishing Polymer >>> applications, using Cordova, on iOS. >>> >>> Does this sound familiar to anybody? >>> >>> Is there anyway to cleanly define the URL where Polymer loads elements >>> (or whatever is loaded via the file:// XHR)? >>> >>> Here is the Apache bug: Allow WKWebView to proxy file:// url loading in >>> XmlHttpRequest.open >>> <https://issues.apache.org/jira/browse/CB-10109?jql=project%20%3D%20CB%20AND%20labels%20%3D%20wkwebview-known-issues> >>> >>> >>> >>> >>> Follow Polymer on Google+: plus.google.com/107187849809354688692 >>> --- >>> You received this message because you are subscribed to the Google >>> Groups "Polymer" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to [email protected]. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/polymer-dev/72dda4a2-5447-4dec-a4e7-b075a02927ad%40googlegroups.com >>> <https://groups.google.com/d/msgid/polymer-dev/72dda4a2-5447-4dec-a4e7-b075a02927ad%40googlegroups.com?utm_medium=email&utm_source=footer> >>> . >>> For more options, visit https://groups.google.com/d/optout. >>> >> >> > Follow Polymer on Google+: plus.google.com/107187849809354688692 > --- > You received this message because you are subscribed to the Google Groups > "Polymer" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/polymer-dev/CACDv4tDu6JrtF1TQcv_KtB1V_W%3Dfouhtbrv_AV6SaMGeLMTH9Q%40mail.gmail.com > <https://groups.google.com/d/msgid/polymer-dev/CACDv4tDu6JrtF1TQcv_KtB1V_W%3Dfouhtbrv_AV6SaMGeLMTH9Q%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > Follow Polymer on Google+: plus.google.com/107187849809354688692 --- You received this message because you are subscribed to the Google Groups "Polymer" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/polymer-dev/CACGqRCA2v%3DZHoE5ROT_OtgZ%2BvS8Kpt59nK_A-Ry-5R%3Dea8HT%3DQ%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
