uiwebview

Send UIWebView title to UINavigationBar

不想你离开。 提交于 2019-12-05 12:04:10
问题 I am trying to send the UIWebView page Title to UINavigationBar. I would also like it if a user clicks on a link the UINavigationBar shows a back button but if on the home page hide the back button. 回答1: to retrieve the title page into an UIWebView you can use it: myNavigationBar.title = [myWebView stringByEvaluatingJavaScriptFromString:@"document.title"]; If you want to go back you can do that: if ([myWebView canGoBack]){ [myWebView goBack]; } To know if the user has loaded a new page you

UIWebView intercept “setting movie path:” from javascript audio player

﹥>﹥吖頭↗ 提交于 2019-12-05 11:50:48
In iOS 4, I've got a page loaded in a UIWebView with a javascript audio player. I did not create this player, it is owned by a third party, so I can't tinker with it. When I click the play button, I see an NSLog printout like the following: setting movie path: http://data.myaudio.com/thefile.mp3 My question is, what is getting it's movie path set and how do I intercept it? The audio will continue to play until I create another UIWebView, or use the built in audio controls accessible by an iPhone home button double tap, or close the app. I can't intercept the path with

Detecting and intercepting video playback in UIWebView

 ̄綄美尐妖づ 提交于 2019-12-05 11:49:46
I would like to intercept a click in an UIWebView and then use the URL of the video. How is this possible? I found a somewhat similar post which pointed met to the webView:shouldStartLoadWithRequest:navigationType: delegate. I cant seem to get the loaded url of the video with this delegate. I am trying to get the code working in iOS8 There is a hacky way of finding the URL by listening for the AVPlayerItemBecameCurrentNotification notification. This notification is fired when a UIWebView shows the media player, and it sends an AVPlayerItem as the notification's object. For example: [

iOS UIWebView of RSS to look more like Safari and stay inside app

别来无恙 提交于 2019-12-05 11:48:22
Im creating an RSS reader app...but I have noticed that UIWebView renders the RSS feed very differently than Safari does. This is the RSS feed... http://www.sigmapi2.org/index.php?option=com_ninjarsssyndicator&feed_id=2&format=raw This is what I want my UIWebView to look like...this is a screenshot from iOS' Mobile Safari NSURL *url = [NSURL URLWithString:@"http://www.sigmapi2.org/index.php?option=com_ninjarsssyndicator&feed_id=1&format=raw"]; NSURLRequest *request = [NSURLRequest requestWithURL:url]; [webView1 loadRequest:request];} produces a blank page in the UIWebView And this code below..

Detect and Customize UIWebView's “Unable to Read Document” error

梦想与她 提交于 2019-12-05 10:28:08
I'm testing a UIWebview with a number of different document types - .xlsx, .jpg, etc. - and it opens most of them just fine. From time to time, I open a local file and this message appears right in the web view: Unable to Read Document An error occurred while reading the document I'm not concerned with "why" this error occurs - it happens, for instance, when I feed the UIWebView a garbage file (intentionally). The problem is that I can't figure out how to detect "when" this happens. It doesn't trigger webView:didFailLoadWithError , it doesn't trigger an NSException (via @try & @catch ), and

How to open url from string in webview for iPhone

心不动则不痛 提交于 2019-12-05 09:59:30
问题 I want to just open a url from my string my string is already having url I just want to show in UIWebView myString=http://maps.google.com/maps?zoom=8&sensor=false&lci=transit&layer=traffic&saddr=1.31224,103.865&daddr=1.310664,103.857132 NSString *urlString = [myString absoluteString]; NSString *urlAddress =myString;// NSURL *url = [NSURL URLWithString:urlString ]; NSLog(@" url is %@",url); its null //URL Requst Object NSURLRequest *requestObj = [NSURLRequest requestWithURL:url]; NSLog(@" url

Getting selected elements programmatically from uiwebview?

别等时光非礼了梦想. 提交于 2019-12-05 09:56:41
Currently I am taking this sample website and showing in my webview. The webpage is displaying correctly. Now I am trying to figure out which data is selected once the user has tapped on the uiwebview. For this I am able to get the CGPoint for the tap by using UITapGestureRecognizer . -(void)singleTap:(UIGestureRecognizer *)gestureRecognizer { CGPoint touchPoint = [gestureRecognizer locationInView:myWebView]; NSString *js = [NSString stringWithFormat:@"document.elementFromPoint(%f, %f).toString()", touchPoint.x, touchPoint.y]; NSString * tagName = [myWebView

UIWebView won't goBack after loading HTML in iOS

99封情书 提交于 2019-12-05 09:42:51
I'm having this problem in my iPhone app: I have a webView which is first loaded with an HTML string. After the user clicks a link and it loads the requested page, the webView won't go back when I call the method [UIWebView goBack]; I suppose webView doesn't cache the HTML string. Is there any way I can make webView cache my HTML string without having to save it in a NSString myself? You can use the canGoBack property and if you can't go back, reload the UIWebView with the original html. If the user has navigated forward using links then the canGoBack property will return YES and a goBack can

Intercepting links in images in UIWebView

被刻印的时光 ゝ 提交于 2019-12-05 09:27:01
问题 In my app, I have a webview, and wanted to open images loaded in a webpage in a separate view controller, which is fine, all I need to do is get the URL to the source of the image & load it in a different view controller, which I can do. Here is the code I'm using to get the URL to the source of the image. -(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch { if ([gestureRecognizer isKindOfClass:[UITapGestureRecognizer class]]) { CGPoint

Open iOS6 Apple Maps app from a link in a UIWebView

╄→尐↘猪︶ㄣ 提交于 2019-12-05 09:18:19
If I display a link to a map in a webpage <a href="http://maps.apple.com/?q=Pricketts+Hill+Southampton+Hampshire+SO32+2JW&ll=50.913127,-1.191398">Location</a> it opens the native iOS6 Apple Maps app when clicked in the standard iPhone Safari browser. When I display the same webpage in a UIWebView inside my app and then click the link, my delegate method - (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType { is called, and the parameters are url=http://maps.apple.com/?q=Pricketts+Hill+Southampton+Hampshire