In my iOS app, I am opening a URL in a UIWebView. On the webpage, there is an option to login through social media like Facebook, Google, Twitter etc.
But when I click on the login through say Facebook option, I see a blank screen. What happens is that, it opens a pop-up in the same UIWebView instance. But I am not sure why I see a blank screen.
The URL works well if I use Safari on my device.
Can you please guide what options on UIWebView shall I enable that the pop-ups work. Also I feel that the pop-up(for FB Login) will throw a callback on the initial page. So please help me how should I handle the call back.
Thanks!
Related
I have the opposite problem of iOS open YouTube App with query (url schemes).
Basically I have a URL such as https://youtu.be/A4yitOx14Bg. When the user taps it, or when I open URL, it normally opens up in the YouTube app. The user can usually customize this behavior with a non-obvious gesture. Namely they can tap and hold the link, and then choose to “Open in YouTube” or “Open in Safari”.
Is there some form of the URL that will always force it to open in mobile Safari, and not require user intervention?
I found this site which has a bunch of different formats: https://gist.github.com/rodrigoborgesdeoliveira/987683cfbfcc8d800192da1e73adc486
Pasting it into notes reveals that the only formats that force a page to load into safari are the youtube-nocookie.com urls. This is an official URL from Google, mentioned here.
Thus the same link above can be changed to https://www.youtube-nocookie.com/embed/A4yitOx14Bg and it’ll forcibly load in mobile Safari.
I started my applicaiton, its open an url in safari. On my website the user can login and do some work. After the user did it the website redirect to the universal link. At first it is working fine, but if the user start again my application, open my website from it (the safari already show my website), login again and redirect to the universal link, show the universal link, and on the top I see a bar where i can open my application.
If the user didn't login to my website, just clicked on the button to redirect to my universal link the ios9 open my application.
Have you got any idea, what's wrong? Maybe the iOS 9 doesn't like the autoredirect to universal link?
Universal links does not work with redirections.
check https://stackoverflow.com/a/32751734/127493
I just been on a similar issue where I clicked the link on the top right side of the screen, disabling the automatic opening in my app.
since you see the banner, the user has to scroll a bit (to show the banner "open" ) and all redirections will occcur on your app again (and not safari)
We are having an issue on our network with iOS devices (ipads, iphones etc): After connecting to the SSID, the iphone / ipad immediately opens the Captive Network Assistant (CNA) - it is like a scaled-down browser without navigation buttons etc - that displays our welcome page (ready for the user to authenticate his MAC in the network to give him internet). This CNA is a functin of iOS, and happens automatically.
I was looking around on this forum how to make the user open his Safari browser by clicking a link (while in the CNA), thus sending him away from the CNA and into Safari (which is where I would prefer him to be).
I searched phrases such as: "How to set a link to open in safari", but I get results about people using phonegap to do such a thing...
One user talked about using
window.open(myURL, '_system')
but I don't know if that is solving my issue.
Basically my plan is to:
- Have my Welcome Page (the page displayed after the user connected to my SSID) detect what type of browser the user's device has. My Welcome Page is hosted at a site which is in the Walled Garden of my controller, so every device can see that Welcome page (whether they have full internet access or not).
- If the user has an iOS device, the CNA browser opens automatically. My controller detects the device has a CNA browser and loads a simple page with the message (like): "click here to start to navigate"
- During the next few seconds (while the user is digesting the message), my controller gives the user's MAC full internet access
- When the user clicks that link in the CNA browser, the CNA closes and then opens Safari, and also forces Safari to open the destination Welcome Page (where I want my user to be, depending on the antenna to which he connected).
I really hope that all makes sense...
I found this link about the CNA browser in this forum:
Bypasses Apple Captive Network Assistant Login in iOS 7
But it talks having the user open Safari right from the start (disabling the CNA function), "hoping" that the user opens Safari (rather then going directly to one of his apps). I prefer that the user has to "click to continue", which makes Safari open and he sees my Welcome Page.
EDIT : this solution doesn't work after iOS 10.3. Not sure if that's a feature or a bug : https://forums.developer.apple.com/thread/75498
EDIT2 : Apparently it works again on iOS 11
There is a simple way to do that, if you have control over the captive portal server.
When connecting to a wifi network, iOS devices send a GET request to a bunch of predefined urls (http://www.apple.com/library/test/success.html, ...) , to see if there is Internet connectivity (wispr requests). The iOS device expects the answer <HTML><HEAD><TITLE>Success</TITLE></HEAD><BODY>Success</BODY></HTML>. If the request succeeds, but the answer is different (for example your captive portal page), it triggers the CNA to open.
At this stage, the CNA thinks you are not connected and will show a Cancel button at the top. Every link will open inside the CNA and not in a Safari window, no matter what you do. The CNA is done so that you can get your user through the log-in process. In order to see if the log-in process is done and connection is finally established, the iOS device will now and then send another wispr request. This happens every 40 seconds, or whenever an HTTP request is emitted (navigation within the CNA).
When your server finally answers Success to a wispr request, the CNA will mark as connected, the button at the top will change into Done. At this stage, any link to an external url will close the CNA and open in Safari :)
So to summarize, you can achieve what you want with the following connection steps :
server answers initial wispr request with your CNA page.
the page opens in CNA. In that page, have some JavaScript that immediately triggers navigation within the CNA, for example : <script>window.location.reload(true)</script> this will trigger the iOS device to immediately send another wispr request
server answers this second wispr request with <HTML><HEAD><TITLE>Success</TITLE></HEAD><BODY>Success</BODY></HTML>, this will trigger the CNA to mark as connected
have your CNA page to show a link to an external url
Extracted from an answer by Ryan at How can I open an external link in Safari not the app's UIWebView?
To have a specific link switch to Safari, simply add target="_system" to the link, as in
Link Text
Or to catch all links in your javascript that have target="_blank", include jQuery and pass them to window.open with the '_system' param. This will work on both iOS and Android.
$(document).on('click', 'a[target="_blank"]', function(ev) {
var url;
ev.preventDefault();
url = $(this).attr('href');
window.open(url, '_system');
});
Javascript does NOT work fully in CNA, it is disabled for security reason.
target="_system" is a safari feature, not a CNA one.
==> briefly, _system fails in CNA.
The situation is like this:
User opens app from a website using a custom urlscheme
User does stuff in the app
User clicks button in the app to return to the website in Safari.
I have tried opening a new tab containing a javascript:window.close() but this does not work on iOS 6.1.
So my question is: Is there a way to open Safari to view the website the user left from? Either with a working new tab that closes itself or a different route?
When you open the app with your custom url scheme, pass the actual page url as an argument.
mycustomUrlScheme://mydomain.com?objectid=1234&callback_url=encoded_url
In your app, handle the url for the content info and keep the page url to open it afterwards. It will make safari open a new tab. But that should be a good start.
As far as i understand you can do it.
user opens mobile safari for example http://www.example.com
user clicks a link that is appscheme://open and the application become active
user taps a button to open safari for example http://www.example.com?q=test
for the third step you can use [[UIApplication sharedApplication]openURL:url]
I'm not a heavy coder here, so i'll ask my best.
We made a brochure about our home town. However users spreading it trough facebook cant open the links when in their facebook app. The app does not send it to safari either. If opened directly from safari it is no problem.
The link is http://visit.lodingen360.com
Is there anything i can do to the site/index.html/whatever that will make it open in safari when the link is clicked in the facebook app for ios? (that won't affect visiting the site from pc's and so on)
Is there anything uiwebview won't read that can force it to safari, so that we can redirect from the thing opened in safari to the site?
Your page will load and display in Mobile Safari, I tried with UIWebView and it will load without displaying an error, but the brouchure page content won't display.
Safari and UIWebView have different user agent's - therefore my guess is that because your site uses flash but it checking for the type of browser you are not performing the check correctly for UIWebView and the page is attempting to use flash which isn't supported.