Cant load iframe on phone


#1

When I run my ionic app on the browser, the iframe load, but it does not load when I run it on phone.

I’m using the plugin https://github.com/apache/cordova-plugin-whitelist

I’m already put in my config.xml:

  <allow-navigation href="http://example.com/*" />


  <allow-navigation href="*://*.example.com/*" />
  <allow-navigation href="http://*/*" />
  <allow-navigation href="https://*/*" />
  <allow-navigation href="data:*" />

  <access origin="*"/>


  <!-- Allow links to web pages to open in a browser -->
  <allow-intent href="http://*/*" />
  <allow-intent href="https://*/*" />

Anyway, the iframe still not load in the view when I run the app on the phone.

Anyone else got this problem?

Thanks!


#2

What are these &apos; ?


#3

It was the type of encoding from where I get the code.

The named character reference ' (the apostrophe, U+0027) was introduced in XML 1.0 but does not appear in HTML. Authors should therefore use ' instead of ' to work as expected in HTML 4 user agents.

I’m already take it off to test, and now I’m working just with the config.xml, like the plugin documentation says to do.


#4

:slight_smile: I knew this HTML entity, I was just asking why they were there because they should not.


#5

What do you see in console when remote debugging your app on phone?


#6

My bad. Sorry =D

My console dont show any erros. He just don’t load the iframe. I’m also using Ionic view app for sync and test it on phone


#7

My app would work on emulation and device with Xcode, and ionic view, but not with ionic emulation or device run. Then I added

<allow-navigation href="*"/>

to config.xml and it worked on all these platforms. Allowing navigation everywhere was not recommended (for security reasons I don’t understand), so I was looking for something more specific and noticed ionic temporarily changed the content tag to

<content src="http://172.27.35.142:8100" original-src="index.html"/>

during emulation and device run. So I replaced the allow-navigation element with

<allow-navigation href="http://172.27.35.142:8100"/>

which works and presumably doesn’t have security issues.

A bit of downside is that either content element above keeps Xcode from running the app. Generally I prefer ionic for device and emulation testing, since it’s easy to see $log and some system messages (which I don’t see in Xcode, though maybe I need to be informed about how to better use Xcode). The Xcode console, however, displays messages the ionic doesn’t, which can be invaluable on rare occasions. If I’m missing a way to see the Xcode console messages in an ionic run, someone please enlighten me.