iOS UIWebView needs to launch specific URLs in separate browser - ios

I created an iOS app that uses a UIWebView to display a mobile website. The mobile site shows a "back" button within the UIWebView for its web server serves, but some pages provide links that navigate to external websites.
I want to provide a "back" button on those pages to get back to the original web server, but if I can't do this then I would like to launch these external sites in the standard browser in such a way that the user can still navigate the original site in the UIWebView using the "back" button already being displayed by the mobile site.
As it stands, my app cannot navigate back to the mobile site once a user clicks one of these "external" links because those sites do not display a back button to get back to the mobile app. How can I resolve this?

Use the delegate webView:shouldStartLoadWithRequest:navigationType: and open the external URL's in the safari using
[[UIApplication sharedApplication] openURL:[NSURL URLWithString: #"http:/wwww.extrenalurls.com"]]

Related

In iOS, is it possible open a url in safari, then go back to the app and reopen safari without pushing a new url?

I have a simple app that opens a link in Safari with UIApplication.shared.open. The user might navigate to any number of urls in the site, and then hit the Back arrow in the top left corner as return to the app. Is it possible to launch Safari again, but without a new url, and simply open the tab at the same url location where navigation stopped, prior to pressing the back button? The only way I know to open Safari is to push a url it, which means a user cannot resume using a site in Safari where they left off. I would appreciate any ideas on how to implement this feature.

Performing a task through a website and going back to an iOS app

I'm developing an iOS 7+ app that I need to offer the option of navigating to a certain web page to let the users to fill in a form there, and after that to come back to the app's view where the user was.
Is it possible to programmatically open Safari with a given url? If it is, I suppose that then there is no way to automatically redirect the user to your app from there... right? Is then a UIWebView the only option? Is it possible to navigate back or dismiss the view with the UIWebView without the need of user interaction?
Thanks
You can open links in Safari as detailed in this post How to launch safari and open URL from iOS app
I don't believe you can set a 'callback' and have it return to your app on completion, as you have no control over the user once they have exited your app's sandbox.
Opening the link in UIWebView would provide control, as you can utilize the UIWebView callbacks.

When implementing AppLinks, the Facebook app creates a special button on the status bar and the app doesn't open up directly

I have added the meta tags in the webpage and I am using the method application:openURL:sourceApplication:annotation: to handle the incoming links, but my app doesn't open up directly. The user has to click on that special button on the status bar in the Facebook's browser in order to open the app.
Please help!

jQuery Mobile Detect Home Screen Bookmark

I know there's no way to add a home screen bookmark automatically within a mobile web app, however, is there a way to DETECT if one has been created?
You could prompt the user to bookmark your app and then save their response (seen here on Mobile Boilerplate). This would allow you to "detect" if they have already added it.
The Mobile Bookmark Bubble is a JavaScript library that adds a promo
bubble to the bottom of your mobile web application, inviting users to
bookmark the app to their device's home screen. The library uses HTML5
local storage to track whether the promo has been displayed already,
to avoid constantly nagging users.

Is it possible to navigate back to the starting point when external links are clicked in a UIWebView?

I've put together a very simple proof of concept app using a UIWebView (and a regular controller) to display a web page.
If the web page has external links then when clicked on the app will switch to the web app.
However there's no way to get back to my original app.
If I add a navigation controller will I get the ability to navigate back, or is there something else additionally that would be required?
(As well as launching web pages it will also be necessary to intercept custom links in the web page and perform some associated action, such as add a contact, in this situation I would also like to be able to navigate back to my app).
TIA
If your links open in Safari, the only way for your user to get back to your app is via the multitasking bar (or obviously quitting and tapping on your app icon)- there is no way to bring your app to the forefront programmatically from within another app.
I am confused though, if you have a UIWebView, the default behavior of clicking on links is to load the linked page in the same web view.
In any case, I think what you are wondering is how to intercept link clicks of a UIWebView so to do that, you should implement the delegate method:
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType
You can then test for clicked links via testing the navigationType property for UIWebViewNavigationTypeLinkClicked

Resources