uiwebview

Playing youtube using <iframe> fails on iPhone, but still works for iPad under iOS 6 (both work fine on iOS 5)

对着背影说爱祢 提交于 2019-12-06 07:34:09
问题 I use the following HTML template with an to hand to a UIWebView. I understand that this is the supported way to play youtube videos. <html> <body> <!-- 1. The <iframe> (and video player) will replace this <div> tag. --> <div id="player"></div> <script> // 2. This code loads the IFrame Player API code asynchronously. var tag = document.createElement('script'); tag.src = "http://www.youtube.com/player_api"; var firstScriptTag = document.getElementsByTagName('script')[0]; firstScriptTag

Why would a link in a UIWebView leave a gray box behind?

喜夏-厌秋 提交于 2019-12-06 07:31:43
I have a UIWebview that I am loading with custom HTML using loadHtmlString. My HTML has a link that I intercept when tapped so that I can take control and reload the UIWebview with a different HTML string. The code works, but the area where the link text was located is replaced with a gray rectangle that is visible when the new string is loaded. What could be going on here? How can I get rid of this behavior? //Scott Here it is...need to add this style statement to the link reference: <a href=http://yourlink.com/ style = "-webkit-tap-highlight-color:rgba(0,0,0,0);"> Setting the alpha value

How to find the responder that is returning YES to canPerformAction:withSender:

蹲街弑〆低调 提交于 2019-12-06 07:23:27
I need to disable the Define menu item from the edit menu on a UIWebView. This is supposed to be done by implementing canPerformAction:withSender: and returning NO for the items to disable. Even though these are private items it seems like I should be able to return YES for the items I want to keep and NO for everything else (as in this question ). However this is not working. The documentation says that If no responder in the responder chain returns YES, the menu command is disabled. Note that if your class returns NO for a command, another responder further up the responder chain may still

Getting the position of an HTML element in UIWebView

一世执手 提交于 2019-12-06 07:22:41
I have UIWebView loaded with an HTML file. I want to know the position (means x and y cordinates) of an HTML element on the screen when the webview is loaded. Thanks in advance William Niu You may need to a combination of JavaScript and Objective-C to achieve this. You need a JavaScript function to pass back the screen position of certain element, and then translate that position to the screen on the iPhone. - (NSString *)stringByEvaluatingJavaScriptFromString:(NSString *)script One way is to write a JavaScript that takes an element ID and returns its position and the screen resolution. Then

Detect video start playing in WKWebView

Deadly 提交于 2019-12-06 07:06:56
问题 I'm using WKWebView for loading an youtube page. I need to detect the video starts playing in the webview in inline mode and in the full screen mode. I tried MPMoviePlayerController Notifiers but they are not calling. But the same is working in UIWebView. So my question is, Is there any difference in the video playing mechanism used in UIWebView and WKWebView ? Why MPMoviePlayerController Notifiers are not calling in WKWebView ? Is there any method to detect the video play in WKWebView ? Or

UIWebView into a UITableViewCell with dynamic size

社会主义新天地 提交于 2019-12-06 06:58:37
问题 I have UIWebView objects into multiples UITableViewCell . Each webView has a different size. Originally, all cells are the same height. Once the user touch the cell, it expand to show all webView Content. I'm using - (void) webViewDidFinishLoad:(UIWebView *)aWebView to dynamically get the webView height, and - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath to resize the cell. However, webViewDidFinishLoad is only called after the resize method,

How can I call Objective-C methods from JavaScript?

故事扮演 提交于 2019-12-06 06:55:49
问题 I want to display SQLite Data base content on UIWebView. For that i have a local HTML file. On Body load in html file calling JavaScript Function. Inside the Java Script how to call Objective-c method. how to get Data from Objective c to Java Srcipt. <html> <head> <!-- a script inline --> <script language="JavaScript" TYPE="text/javascript"> <!-- function myJsFunc() { //here i want to call objective-c methods. } // --> </script> </head> <Body Bgcolor=#800000 onload="myJsFunc(); return true;">

Displaying an image in UIWebView

泪湿孤枕 提交于 2019-12-06 06:51:21
问题 I'd like to dislay an image in UIWebView using <img src="imageInBundle.png"/> The above image is in my bundle. I load it, along with other HTML in a string, like this: [myWebView loadHTMLString:htmlString baseURL:[NSURL URLWithString: @"http://www.abc.com"]]; However, I just get a blue box with a white question mark. Is there something else I need to do? 回答1: Try to change the [NSURL URLWithString: @"http://www.abc.com"] to a [NSURL fileURLWithPath:path] where path is something like NSString

Install .mobileconfig Programmatically

。_饼干妹妹 提交于 2019-12-06 06:46:51
问题 I am writing an app in order to automate the process of connecting an Apple mobile device to a wifi network and downloading configuration profiles to the device. Since it is being automated (by something such as Native Driver), all of the functions need to be controlled by the app itself, not sent to another app such as Settings or Safari. I am already using Apple80211 private framework to connect to a wifi network as well as UIWebView in place of a browser in order to navigate to a specific

It is posible to load customise HTML view into webView in swift?

断了今生、忘了曾经 提交于 2019-12-06 06:42:48
suppose I am loading url into webView and it looks like: But I want to remove some unwanted thing from this url like: I searched a lot on internet but nothing helpful found.but I think that I have to remove some of tag from HTML view before it's load into webView. but I don't know how to do this. Is it possible and if yes then how can I perform this action? Please help me for this. I have found the solution for my question and for that THIS tutorial helps me a lot. as shown into this tutorial here is the step by step example for load a customised HTML View into webView . A Web View From a