uiwebview

How to Load large HTML string in WebView with LoadHTMLString method?

十年热恋 提交于 2019-12-02 07:57:30
问题 I have to load an html string onto the UIWebView with 'LoadHTMLString' method of UIWebView. Please find the below code. [wv loadHTMLString:[NSString stringWithFormat:@"<!DOCTYPE html><html><head><meta name=\"viewport\" content=\"initial-scale=1.0, user-scalable=no\"><meta charset=\"utf-8\"><title>Traffic layer</title><style>html, body, #map-canvas {height: 100%%;margin: 0px;padding: 0px}</style><script src=\"https://maps.googleapis.com/maps/api/js?v=3.exp\"></script><script>function

multi-tab web browsers with UIWebView on iOS

倾然丶 夕夏残阳落幕 提交于 2019-12-02 07:51:17
I'm creating a simple web browser. I want my users to add tabs and browse many web pages at the same time, like in Safari, Firefox or Chrome. I've done this and it works great but I don't know if there is a simpler way to do this. When the user adds a new tab, my application creates a new UIWebView in the background that is related to the new tab and loads a new URL. When the user selects another tab, the UIWebView that is related with this tab appears and the other disappears. Just it.. I would use a UIViewController with the tabs as a parent view controller. Each tab would be associated with

Xamarin iOS Universal Links support for Twitter Auth

。_饼干妹妹 提交于 2019-12-02 07:45:53
So, now twitter from 25 sep supports universal linking, it means that when UIWebView hits https://twitter.com/oauth/authorize?oauth_token link, it tries to open a twitter app, and if it is there, then it redirects me to auth page with auth error, so I wonder, how can I disable it from code, without uninstalling twitter app, or how I can enable universal linking auth in my xamarin ios app? Is it possible at all? (similar question but for native: Disable Twitter Universal Deep Links ) Unless Twitter removes/updates the apps section of " https://www.twitter.com/apple-app-site-association " to

UIWebView Delegate Methods not Working [closed]

喜你入骨 提交于 2019-12-02 07:42:20
**When I Use self.myWeview.delegate = self , UIWebView can not load URL in UIWebView ... But If I set it to self.myWeview.delegate = nil , then methods(delegate) can't load but URL is load this is the code:--- { self.myWeview.delegate = nil; NSURL *url = [NSURL URLWithString:@"http://www.google.com"]; NSURLRequest *request = [NSURLRequest requestWithURL:url]; [myWebView loadRequest:request]; } This is working fine but couldn't called delegate methods. On the other hand { self.myWeview.delegate = self; NSURL *url = [NSURL URLWithString:@"http:http://www.google.com"]; NSURLRequest *request =

How to load Map view using the WebView Url in iphone

我们两清 提交于 2019-12-02 06:02:52
I'm loading a mapview using UIWebView by an url like http://www.google.com/maps?saddr=Massachusetts,+United+States&daddr=Sunnyvale,+CA,+United+States . This leads to load a direction view instead of mapview with Direction. Can any one tell me how to load mapview with directionLine from source to destination using the above url? PanPiotr Just add &output=embed at the end of your link: http://www.google.com/maps?saddr=Massachusetts,+United+States&daddr=Sunnyvale,+CA,+United+States&output=embed 来源: https://stackoverflow.com/questions/6248501/how-to-load-map-view-using-the-webview-url-in-iphone

WKWebView only showing desktop site

筅森魡賤 提交于 2019-12-02 05:36:19
问题 I just migrated from UIWebView and my new WKWebView will only show the desktop version of the site I'm loading. My UIWebView showed the responsive site appropriately. I have tried forcing a mobile User-Agent and confirmed that it is coming in on to the server let userAgent = "Mozilla/5.0 (iPhone; CPU iPhone OS 7_0 like Mac OS X) AppleWebKit/537.51.1 (KHTML, like Gecko) Mobile/11A465 Twitter for iPhone" webView.customUserAgent = userAgent Does anyone have any other ideas I can try? Thanks 回答1:

Disable hyperlinks in UIWebView

夙愿已清 提交于 2019-12-02 05:26:20
问题 I want to disable hyperlinks in UIWebVIew after the initial page loaded without disabling the scrolling feature. That is, I should have user interaction enabled. 回答1: You can work with webView shouldStartLoadWithRequest like this: (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType; { NSURL *loadURL = [[request URL]retain]; //change next line to whatever condition you need, e.g. //[[loadURL relativeString

How do I add Pull to Refresh in WebView?

笑着哭i 提交于 2019-12-02 05:10:17
问题 I'm very new to developing. I'm building a WebView and I want it to have pull to refresh capabilities. How do I go about doing that in swift? My code in the View Controller is @IBOutlet var webView: UIWebView! override func viewDidLoad() { super.viewDidLoad() func webViewDidFinishLoad(webView: UIWebView) { UIApplication.sharedApplication().networkActivityIndicatorVisible = false } func webViewDidStartLoad(webView: UIWebView) { UIApplication.sharedApplication().networkActivityIndicatorVisible

Overlay an UIButton over an UIWebView in Swift

末鹿安然 提交于 2019-12-02 05:08:40
So I have a view that loads a UIWebView and I want to overlay UIButton the user can tap on to go to another view. I managed to place the button over the web view but I can't seem to be able to tap on it. Here's my code: class ButtonView: UIView { var button: UIButton! override init(frame: CGRect) { super.init(frame: frame) button = UIButton(frame: CGRectMake(0, 0, 50, 50)) button.layer.zPosition = 10 self.addSubview(button) } required init(coder aDecoder: NSCoder) { fatalError("Init(coder:) has not been implemented") } } class MyViewController : UIViewController, UIWebViewDelegate { var

How to set the local storage before a UIWebView loading its initial request?

荒凉一梦 提交于 2019-12-02 04:56:08
问题 ViewController import UIKit class ViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() let wv = UIWebView(frame: UIScreen.main.bounds) wv.stringByEvaluatingJavaScript(from: "localStorage.setItem('key', 'value')") wv.loadRequest(URLRequest(url: URL(string: "http://localhost:63343/test.html")!)) self.view.addSubview(wv) // Do any additional setup after loading the view, typically from a nib. } } test.html <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF