After using Application.OpenURL(), is it impossible to get back to the Unity app?

Hi! I’m creating an iPad app that uses Application.OpenURL to open a dynamic webpage that shows a list of PDF files. The problem is that after using Application.OpenURL, a Safari window replaces my Unity app, and there is no button to go back or close the window.

Is it impossible to get back to the Unity app after using this method? If so, is there another way to show an html page without closing my app?

OBS: note that it doesn’t help to just “fetch” the contents of the page, because the pdf files are opened in new Safari windows anyway.

Some context (for the curious only): I’m creating a medical software here in Brazil and I’m using Unity to show a list of drugs (legal ones!). Each of those drugs has one or more “drug description leaflets” that can only be obtained from “Anvisa” website, a regulatory agency. I query the website with the drug’s name and get an html with a list of pdfs.

Anyone?

It’s possible. We’re using the Social plugin from Prime31 and the FB login will kick you from Safari back into your app. I think this is how.

I would like to know this as well.

Thanks @nocanwin! I’ll look into this plugin. Anyone has any other way to show a browser inside Unity iOS?

Hi DeigoLeao – take a look at this thread…I would imagine (?) a UIWebView would play nice with either approach, however I haven’t tested it.

You’ll need to use a custom URL scheme. This will involve patching the application delegate and making some additions to the apps plist. This can all be done via script in Unit’s post process build step if you don’t want to do it by hand every time you build the Xcode project. You’d probably need to have your own web code with the site you were looking at in an iframe so you could have your own button to redirect to your URL scheme.

See here for info on custom URL schemes: Documentation Archive

All that said, Prime31 offers the Etcetera plugin which implements a WebView that is part of your application rather than opening a separate browser and then needing URL schemes to open your app back up. This might be an easier choice. You could code this up yourself, but I’m guessing his price is cheaper than your time.

1 Like

Is there any standard approach that doesn’t only work for Apple? I’m looking to do this on the Quest. Thanks