UIWebView opens non-related site - iphone

I opened a website by using UIWebview, but some times when I clicked on a button or a link, it automatically calls a non-related website. E.g. when I click on a Facebook link, it goes directly to the App Store and asks for Facebook installation process (even if Facebook app is installed). After that I can't go back in my app. So I have to exit and re-open my app.
Why is it moving to the App Store even if Facebook app is already installed?
Is there any possibility to add a back option to the App Store?
Code:
webviews.scrollView.decelerationRate = UIScrollViewDecelerationRateNormal;
[webviews loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:#"URL of the web site"]]];
webviews.scalesPageToFit =YES;

You can use UIWebview delegate to control what the webview can or can't open (check ....shouldStartLoadWithRequest:...)
http://developer.apple.com/library/ios/#documentation/uikit/reference/UIWebViewDelegate_Protocol/Reference/Reference.html

Related

Open and close url in safari using objective-c program

I have to open a URL in safari... and after doing some work on safari I have to close the safari...
my code is as below.
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:strPageUrl]];
Actually I have to share video on myspace.. if user has shared the video then I have to close safari and need to activate my application again.
I want to do something similar facebook SDK login with safari..
Please help me how to open this
custom url schemes work only one way... Like if you opened safari from your application then you can't return back to your application unless the second application is also yours and you have implemented another custom url to return back to your application. Since safari was made by apple so it does not have info regarding your application.
I am not exactly sure what you are trying to achieve but you can try out UIWebView for requirement if it helps.

How to Link to a Website or Safari within my iOS app

I am using Xcode to develop an iOS app and I need to know how to link a website to a button to open with in the app. I want o have a drop down bar that has buttons to return to a separate screen and a button to save the link to another place. Is there a way to open a website or a link to safari with my app?
You can open a website directly by using a UIWebView object in your app.
You can get Safari to open a web site by invoking something like [[UIApplication sharedApplication] openURL:myURL].

admob click action type that launch safari and go to the web url

I have 2 admob ad on an ipad app.
One is 320*250
another one is 468*60
When I click the 2 two ads
I found the first one will go to the web url and launch safari,
the second one will push up a window and display the web url.
Is it possible to change the second ad banner action to go to the web url and launch safari also?
I am not sure if I need to change the client codes or do something on admob server side setting.
Welcome any comment
Unfortunately I don't think this is something that you can control. It looks like it's a part of the AdMob SDK where the ad creative determines what type of view to put you into when a click happens.
I have used to launch a web view safari using this code please try it. Its working fine in my Application.
NSURL *url = [NSURL URLWithString:#"http://www.stackoverflow.com"];
if (![[UIApplication sharedApplication] openURL:url])
NSLog(#"%#%#",#"Failed to open url:",[url description]);
Thanks.

iOS-Facebook connect with UIWebView

I am a beginner in iOS programming. I am trying to build an Facebook app using iOS SDK for facebook. I have downloaded and integrated the facebook SDK with my sample app. I have also created my app id. I am also able to start my app by (after facebook object creation):
[_facebook authorize:#"123456" permissions:_permissions delegate:self];
Here user authorization takes place within the default iphone browser.
After successful user authorization, I am trying to pass a facebook url pointing to a particular person's facebook wall, within a UIWebView. Now the problem that I am facing is that UIWebView opens up the url in which Sign In/Login option is again there, which should not be the case as I have already done the facebook authorization part.
So my question is how to pass the active facebook session within UIWebView, so that the authenticated user can straight away open any facebook url within UIWebView.
Strangely, instead of UIWebView if I use the following code to connect to a facebook url , i am allowed to successfully connect as an authenticated user:
NSString *url = [NSString stringWithFormat:#"http://www.facebook.com/xmarshall123"];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString: url]];
The above code off course opens the default browser, and that's probably why I am able to connect to the facebook url as an authenticated user.
Please help.

UIWebView doesn't respond to link-taps when the link goes to a different domain

I load a page, saw on twitter, using a line like this:
[self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:#"http://twitter.com/OGOchoCinco"]]];
The page shows up fine. If the user now taps on a link that brings them somewhere else within twitter, she is brought to that page. However, if the link goes to http://twitpic.com, the web view simply doesn't respond. If the user clicks on a twitter.com link again, the browser follows that without a problem.
Any ideas would be appreciated.
I've been able to browse across different domains in my app, so that may not be the problem.
However, the links in a twitter feed seem to target a new browser tab/window, which doesn't work with UIWebView.
See Opening popup links in UIWebView, possible? for potential workarounds.