Hi all,
My Meteor Cordova app (Allowance Tracker - Bomad on the App Store ) won’t load because of iOS Screen Time web content restrictions. My users see the following screen after launching the app:
Tapping “Allow Website” does nothing.
This happens when web content is restricted to approved sites only:
If I add “localhost” as an approved site, it works:
I’ve tested on iPadOS 17.5.1 and iOS 17.6.1
So I think this means that no Meteor Cordova apps will work when web content is restricted like this on iOS?
I’ve searched but I haven’t been able to find much about this problem. I did find confirmation here though:
https://forums.developer.apple.com/forums/thread/732008
But nothing in the Cordova forums (GitHub - apache/cordova-ios: Apache Cordova iOS )
I tested another app (Chores & Allowance Bot on the App Store ) which I think is a wrapper on a website and it worked without being “allowed” as above. I’m not sure what to make of that.
Any suggestions and advice would be much appreciated. Thanks!
P.S. Where else might I asked about this? I’m going to try Issues · apache/cordova-ios · GitHub
Here’s the Cordova iOS issue I just posted:
opened 05:01PM - 09 Sep 24 UTC
# Bug Report
## Problem
### What is expected to happen?
First app scree… n is shown after launch
### What does actually happen?
An error screen is shown with the message: 'You cannot browse this page at “localhost” because it is restricted'
![Finder 2024-09-09 18 21 02](https://github.com/user-attachments/assets/1a3e0715-bd57-46c4-8384-24cc4ed549a8)
## Information
This happens when "Content & Privacy Restrictions" are enabled in Settings > Screen Time, and "Web Content" is set to "Only Approved Websites" under "Store, Web, Siri & Game Center Content"
If the website "localhost" is added to the list of approved websites ("Add Website"), everything works fine.
### Command or Code
Enabled the restrictions as above and install and launch any Cordova app (try mine: https://apps.apple.com/us/app/bomad-kids-money-tracker/id6446114229)
### Environment, Platform, Device
I’ve tested on iPadOS 17.5.1 and iOS 17.6.1
### Version information
<!--
What are relevant versions you are using?
For example:
Cordova: Cordova CLI, Cordova Platforms, Cordova Plugins
Other Frameworks: Ionic Framework and CLI version
Operating System, Android Studio, Xcode etc.
-->
I'm using Meteor 2.16 (meteor.com), which in turn uses Cordova iOS v7.0.1
## Checklist
- [x] I searched for existing GitHub issues
- [x] I updated all Cordova tooling to most recent version
- [x] I included all the necessary information above
Thanks, but what specifically are you suggesting I try?
I think this sounds promising, but it would require changes to Meteor Cordova:
For those who are still stumbling upon this, newer versions of cordova-plugin-ionic-webview now support using the app scheme instead of serving over http://localhost . Using the app scheme will allow the app to not get blocked by iOS’ Content Restriction. Hope this helps!
Specifically,
would need to be changed to use “the app scheme” instead of http://localhost
rjdavid
September 9, 2024, 11:16pm
5
It has been years since we moved to PWA so my cordova knowledge might be obsolete. But there should be an accessRule
method for the config to set <allow-navigation>
Thanks, but I checked in my config.xml and Meteor already includes a rule to allow localhost access:
<allow-navigation href="http://localhost" />
This problem arises because recent versions of iOS block localhost when Screen Time is used to restrict web content. This overrides all the allow rules in the app.
1 Like
I’ve also filed a bug report on Github:
opened 06:09AM - 10 Sep 24 UTC
<!--
Before reporting a bug, please check for existing or closed issues
first … and read the instructions for filing a bug report:
https://github.com/meteor/meteor/blob/devel/CONTRIBUTING.md#reporting-a-bug-in-meteor
### This bug report should include:
- [X] A short, but descriptive title. The title doesn't need "Meteor" in it.
- [X] The version of Meteor showing the problem.
- [X] The last version of Meteor where the problem did _not_ occur, if applicable.
- [X] The operating system you're running Meteor on.
- [X] The expected behavior.
- [X] The actual behavior.
- [X] A **simple** reproduction! (Must include the Github repository and steps to reproduce the issue on it.)
If you don't include a reproduction the issue is probably going to be closed.
### Independent packages
Please ensure your issue is opened in the appropriate repository:
* Feature Requests: https://github.com/meteor/meteor/discussions
* Blaze: https://github.com/meteor/blaze/
* Galaxy Guide: https://github.com/meteor/galaxy-docs/
-->
Recent versions of iOS block access to localhost when web content is restricted by Screen Time. Since Meteor uses http://localhost to serve Cordova content, users see this error page when opening the app:
![Finder 2024-09-09 18 50 30](https://github.com/user-attachments/assets/cd3e0661-cd6a-4da8-8453-6ed49c286fed)
Tapping "Allow Website" does nothing.
This happens when web content is restricted to approved sites only:
![Finder 2024-09-09 18 21 46](https://github.com/user-attachments/assets/027902f0-4275-453a-85e5-ff9e00f4c588)
If I add "localhost" as an approved site, it works:
![Preview 2024-09-09 18 25 18](https://github.com/user-attachments/assets/f328c2f0-25fd-4d01-9933-fbc08da9580e)
(You can type anything into the Title field, Bomad is just the name of my app)
This happens on iPadOS 17.5.1 and iOS 17.6.1, but also on iOS 16 (see https://forums.developer.apple.com/forums/thread/732008).
I've tested on Meteor 2.16, but I'm quite sure the problem exists for Meteor 3 too.
This seems to be a possible solution:
> For those who are still stumbling upon this, newer versions of cordova-plugin-ionic-webview now support using the app scheme instead of serving over http://localhost/. Using the app scheme will allow the app to not get blocked by iOS’ Content Restriction. Hope this helps!
(source: https://stackoverflow.com/a/60998000/1420157)
**How to reproduce:**
1. Enable web content restrictions:
Go to Settings > Screen Time > Content & Privacy Restrictions > Store, Web, Siri & Game Center Content ("Content Restrictions" on iOS 16) > Web Content
and choose "Only Approved Websites"
2. Install any Meteor Cordova app (you can use mine: https://apps.apple.com/us/app/bomad-kids-money-tracker/id6446114229)
3. Open the app, you will see the error page above
I just realized that pressing “Allow Website” on the error page:
adds “localhost” to the list of approved sites.
However, it doesn’t trigger a reload, so the error remains on the screen. It also doesn’t give any other kind of feedback, so it seems like nothing happened.
If you close the app and re-open it, it works. However, it’s not obvious that you need to do this.