uiwebview

Can we open pdf file using UIWebView on iOS?

有些话、适合烂在心里 提交于 2019-12-17 03:21:54
问题 Can we open the pdf file from UIWebView? 回答1: Yes, this can be done with the UIWebView. If you are trying to display a PDF file residing on a server somewhere, you can simply load it in your web view directly: Objective-C UIWebView *webView = [[UIWebView alloc] initWithFrame:CGRectMake(10, 10, 200, 200)]; NSURL *targetURL = [NSURL URLWithString:@"https://www.example.com/document.pdf"]; NSURLRequest *request = [NSURLRequest requestWithURL:targetURL]; [webView loadRequest:request]; [self.view

Is it possible to set a cookie manually using sharedHTTPCookieStorage for a UIWebView?

不打扰是莪最后的温柔 提交于 2019-12-17 03:21:26
问题 I have webviews inside of an iOS application that require an authentication cookie to be properly authenticated. I'm looking for a way to set a cookie inside of an iOS application's webview without having to make an outbound request to set the cookie as I have auth information on the client already. This post shows us where the UIWebView cookies are stored. Right now I'm loading a hidden web view to make an outbound request but would prefer not to have to make an external request for setting

Getting all cookies from WKWebView

一世执手 提交于 2019-12-17 02:58:18
问题 while getting cookies from UIWebView seems straightforward by using NSHTTPCookieStorage.sharedHTTPCookieStorage() , it seems WKWebView stores the cookies somewhere else. I did some research, and I was able to get some cookies from the grabbing it from NSHTTPURLResponse object. this, however, does not contain all the cookies used by WKWebView : func webView(webView: WKWebView, decidePolicyForNavigationResponse navigationResponse: WKNavigationResponse, decisionHandler:

How to determine UIWebView height based on content, within a variable height UITableView?

有些话、适合烂在心里 提交于 2019-12-17 02:54:11
问题 I am trying to create a UITableView with variable height rows as explained in the answer to this question My problem is each cell contains a UIWebView with different (statically loaded) content I can't figure out how to calculate the proper height based on the content. Is there a way to do this? I've tried things like this: (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { WebViewCell *cell = (WebViewCell*)[self tableView:tableView

iOS JavaScript bridge

╄→尐↘猪︶ㄣ 提交于 2019-12-17 02:24:59
问题 I'm working on an app where I'm going to use both HTML5 in UIWebView and native iOS framework together. I know that I can implement communication between JavaScript and Objective-C. Are there any libraries that simplify implementing this communication? I know that there are several libraries to create native iOS apps in HTML5 and javascript (for example AppMobi, PhoneGap), but I'm not sure if there is a library to help create native iOS apps with heavy JavaScript usage. I need to: Execute JS

Play facebook video in UIWebView

时光毁灭记忆、已成空白 提交于 2019-12-14 04:18:28
问题 Does anyone know how to play a facebook video in a UIWebView ? My app uploads video to facebook and retrieves the video's url. I'd like to embed this url into a UIWebView to play back. I've worked this out for youtube but not Facebook. looking for help. 回答1: Orpheus! I’m a few years late lol, but I’ll post the answer here anyway -- in Swift since it’s 2018 ;) -- just in case someone needs it. You can use the following HTML string: let embedCode = "<iframe src=\"https://www.facebook.com

iOS : detect UIWebView reaching the top or bottom

99封情书 提交于 2019-12-14 04:16:25
问题 How can I detect UIWebView reaching the top or bottom? Because I need to trigger an action when I reach the bottom. So is that doable? 回答1: First of all, you should not put your UIWebView inside a UIScrollView as mentionned in the UIWebView documentation. Important: You should not embed UIWebView or UITableView objects in UIScrollView objects. If you do so, unexpected behavior can result because touch events for the two objects can be mixed up and wrongly handled. Instead, you can access the

Soundcloud iframe doesn't work with UIWebView swift

笑着哭i 提交于 2019-12-14 03:44:42
问题 I'm using iframe and 'Widget API' to control the streaming. When i call 'Play(); or 'Pause();' the play button is changing but is not playing audio. @IBOutlet weak var videoWebView: UIWebView! var soundCloudIsLoaded : Bool = false var isPlaying : Bool = false override func viewDidLoad() { super.viewDidLoad() self.videoWebView.isUserInteractionEnabled = true self.videoWebView.allowsInlineMediaPlayback = true var htmlString = "<iframe id=\"sc-widget\" width=\"100%\" height=\"350\" scrolling=\

“Plugin handled load” dialog appears when playing a video within a web page within UIWebView

拜拜、爱过 提交于 2019-12-14 03:42:04
问题 If I click on a link to a video within a web page being displayed by UIWebView then the video plays but a dialog pops up saying "Plugin handled load". Does anybody know why this happens and how to stop it from happening? This is not a duplicate of: Playing videos in UIWebView broken in iOS4? as I am not creating a UIWebView with a zero size frame, which is described as the cause. (Am using iOS 5) 回答1: The problem would seem to be in the fact the UIWebView does not include the same user agent

Can I pass a variable from a UIWebView back to my app using Javascript (or any web technology)?

我只是一个虾纸丫 提交于 2019-12-14 03:39:47
问题 I have a UIWebView with a form on it. I would like to get the response from the form sent back to my application so that it can respond accordingly. Is there anyway to do this with javascript or anything? 回答1: Something like: NSString *formValue1 = [webview stringByEvaluatingJavaScriptFromString:@"document.forms[0].elements[0]"]; 来源: https://stackoverflow.com/questions/4620972/can-i-pass-a-variable-from-a-uiwebview-back-to-my-app-using-javascript-or-any-w