In iOS, my app doesn't allow dialogues or external browser to come to the forefront


#1

In iOS, my app doesn’t allow dialogues or another browser to come to the forefront.

My app shows some content from our website and I set external links to open in the default browser rather than in the app. At first I thought it wasn’t working in iOS, it looked like nothing happened when you tap a link. But when I closed out the app, the links were open in in Safari… you just don’t see it until you close the app or switch out of the app. My expectation is that when you click a link it opens in the browser and shows in front of the app, not hidden behind it until you close out the app.

Also, after I closed out the app I saw a dialogue window from iOS asking me to give it permission to access location information. This probably should be seen right when the app is opened the first time. I use location in the app to calculate the user’s local sunset time.

I use PhoneGap to produce the APK and IPA for my app. In Android, it works like I would expect, dialogues from the OS come to the forefront. Clicking links opens a browser in the forefront. In iOS, the older iPad (iPad2) I tested on worked similarly. However the two iPhones (6S I believe) did not allow the dialogue or the browser to come to the forefront. On both phones, I didn’t see the dialogue or the Safari browser until I closed the app.

Has anyone experienced something similar?


#2

Hello Jason, try this:

Under Project Properties and Globe Code -> contentSecurityPolicy:

default-src ‘self’ gap://ready; style-src * ‘unsafe-inline’; script-src * ‘unsafe-inline’ ‘unsafe-eval’; media-src * blob:; img-src * data:; connect-src *;


#3

Thank you Salvador, I will try this although I’m not sure what part of those settings would help. The links open, the content loads, the dialogues fire… they just aren’t visible until you hit the home button to minimize the app. It’s worth a shot though, if it works it works. :slight_smile:


#4

This didn’t seem to have any affect. I’m now testing on two different iPads, an old one that can’t update to the newest version of iOS, and a new iPad Mini 4 that I updated today. Dialogues and external links are working great on the old iPad. They “work” on the new iPad also, except that I only see the dialogues and webpages opened externally AFTER I exit the app.


#5

What is a “dialogue” exactly? What AppStudio feature are you using?

How are you opening the webpages?


#6

By dialogue, I mean a box that comes up and asks for user input. In my case, its the little window that iOS pops up and asks the user permission to use their location.

I’m opening external links like this:
JavaScript
$(document).on(‘click’, ‘a’, function (event) {
if (typeof $(this).attr(‘href’) != “undefined”){
if($(this).attr(‘href’).startsWith(“http”)){
event.preventDefault();
var w = window.open($(this).attr(‘href’), ‘_system’);
w.focus();
return false;
}
}
});
End JavaScript

This works like I think it should in Android, and older versions of iOS.


#7

So the dialogue isn’t part of your code, but rather what the OS does automatically when an app needs the location?


#8

Correct. In both cases (dialogue and external links) both appear, but only after minimizing the app.


#9

Sorry, maybe that’s not the correct term. “Dialogue” is what I saw it being called somewhere else.


#10

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.