UIWebView Stops Entire App When Double Tap - ios

I have an iOS app that stops responding if a user double clicks any link in the UIWebView. I have no output in the log when this happens, it just stops responding. I'm not sure how to debug, or get any more information from this problem. Does anyone have any suggestions on how I can proceed? I vaguely remember this being an endless loop glitch within UIWebView from an earlier app I created, however I cannot find any record of this online or in the latest XCode.
If anyone has advice as to where I can pull data from to help identify the problem, I would be very appreciative. So far I've monitored NSLog output and the crash logs on the iPhone.

All of the JavaScript and actions taken by a UIWebView occur on the main thread; which is probably causing the hanging behavior.
I would assign a class to the the delegate of the UIWebView and implement the 'webView:shouldStartLoadWithRequest:navigationType:' method of the delegate. This method gets called on each request made by the UIWebView. Logging within this can show you what AJAX calls or other resource calls are being made by the web app.

Try to review my answer. it may help you.
<html>
<body>
<a href=\"http://www.google.com\" target=\"_blank\" title=\"Google Link\"
name=\"Google\">http://www.google.com</a>
</body>
</html>
i have added link "www.google.com" in html string. Now When user click on the link it will open into iPhone default browser.
Don't forget to add UIWebview Delegate Method in you Code.

Related

How to prevent reload on Tizen Public Preview Deeplink?

I'm writing a web app for Tizen Smart TV. One of the required features is implementing the Smarthub Public Preview deeplinking.
I have setup the app to open at a specific content when the Public preview tile is clicked. However, I cannot prevent the app to reload. The documentation mentions adding the appcontrol event to the window event listeners, but I don't think this event is being recognized by the app, since the code is not executed.
It only works if I directly add my deeplink() method to the onload property.
According to documentation, this piece of code should prevent the app to reload, but it is not working:
<tizen:app-control>
<tizen:src name='index.html' reload='disable'></tizen:src>
<tizen:operation name='http://samsung.com/appcontrol/operation/eden_resume'></tizen:operation>
</tizen:app-control>
window eventListener is not working wither:
onload="window.addEventListener('appcontrol', deepLink)"
Any help on how to implement this correctly?
Thank you in advance
You are probably modyfing window.location in the app (ie in router).
reload='disable' prevents reloading index.html. When application receives app control request and page is different, application will be reloaded.
You can find more about appcontrol in Tizen documentation (note that Tizen for TV may differ from other devices):
https://docs.tizen.org/application/web/guides/app-management/app-controls/
I've got some information regarding your question.
To do application resume without Page reload,
Set extra data in app-control like below
key: SkipReload
value: Yes

How can a I use the window.print method in a WebView with react-native

I'm using react-native and its webview to call a webpage where at the end of a flow of four or five pages, they use the window.print method to print the page. But, when I tap the button to print the page nothing happens. Do you know what can I do in this situation to make the button work?. I've only tried this in Android and I use "react-native-webview": "^5.10.0" with "react-native": "^0.59.9".
I am using a work around for now as my react native webview app only consists of the uri of the web app. What I am doing is I am checking if window.ReactNativeWebView exists or not. If yes, then do window.ReactNativeWebView.print() so for my app it takes me to the external browser of that device and there since window.ReactNativeWebView doesn't exists, I do window.print().
I am not sure if this is the right way to do but if someone has a better solution. I am eagerly waiting for it!

xamarin android customtabs NavigationEvent won't call

I'm using android.suport.customtabs in xamarin to show webpages,
i can't get NavigationEvent to be called, when pages are done loading.
i followed the sample from here:
https://github.com/xamarin/AndroidSupportComponents/blob/master/customtabs/samples/ChromeCustomTabsSample/MainActivity.cs
But can't get it to work.
It opens the page, and i can customize it, but NavigationEvent never gets called, what are the sample missing??
please any info would be a big help.

Close in app browser after a redirect

We have an ad partner that is redirecting users to the app store after an ad in our app is tapped. We load an in-app browser which does the redirect. Nothing in the browser ever loads, it is just a white screen. Once the user returns to our app they are looking at that empty browser. Is there anyway to dismiss or close that browser once the redirect is completed?
We don't have any control over the server side.
What kind of in-app browser you are using in your app? Like a library or an UIWebView? If it's an UIWebView, there's a callback method when the webpage is loaded (and probably, redirected the link):
- (void)webViewDidFinishLoad:(UIWebView *)webView;
If you're using a library, I'm pretty sure it also has a method like that.
I fixed this by skipping the in-app browser and used Safari instead. App store re-directs are happening without showing the browser window and all the other ads are working as expected.
Plus I got to delete a bunch of old code.

iAd Producer - How to open a URL in safari?

I'm just doing some initial research into creating iAds with iAd Producer, but we'd like to link the ad to an external website, rather than an iTunes listing.
Is this possible, if so, how would you go about it? Ideally clicking on the ad would open the link in Safari, but if there is a UIWebView equivalent that would be fine too (The WebGL view control confusingly seems to be for displaying 3d objects).
Many thanks in advance.
Ted
I'm not familiar with iAds, what does it look like when specified in HTML?
According to this http://developer.apple.com/library/ios/#featuredarticles/iPhoneURLScheme_Reference/Introduction/Introduction.html
it looks like it won't be recognized.
(This is s useful reference in this area: http://wiki.akosma.com/IPhone_URL_Schemes)
But if you load the page in a UIWebView you can intercept the iAds link within shouldStartLoadWithRequest: and launch Safari yourself from there.
Ah, I've realised now I was overcomplicating things somewhat / missed the easy answer.
The iAds produced by iAd Producer are all HTML, with Javascript added to handle page / control events. This should have given me the clue that they themselves are executing in some sort of UIWebView control.
Hence, when I added the following Javascript, on a button click event, the user is warned they are leaving the app (well they were when leaving the iAd Tester app) and then thrown out into Safari to view the website, as I wanted all along. Simple. I guess it's not really what Apple want people to do with iAds (it's not driving them to the appstore), hence it's not that well documented.
this.onViewTouchUpInside = function (event) {
document.location = "http://www.google.co.uk";
};

Resources