I have developed an app which shows a web page using WKWebView in Swift. I need to disable the user selection and the callout (because the web loads a graph) and I don't find any way to do this with WKWebView.
This is my code:
import UIKit
import WebKit
class ViewController: UIViewController, WKNavigationDelegate, WKUIDelegate {
@IBOutlet weak var webView: WKWebView!
override func viewDidLoad() {
super.viewDidLoad()
let url = URL(string: "https://danfg95glucose.azurewebsites.net")
let request = URLRequest(url: url!)
webView.navigationDelegate = self
webView.load(request)
}
}
I want to do something similar with this but in Swift with WKWebView:
// Disable user selection
[webView stringByEvaluatingJavaScriptFromString:@"document.documentElement.style.webkitUserSelect='none';"];
// Disable callout
[webView stringByEvaluatingJavaScriptFromString:@"document.documentElement.style.webkitTouchCallout='none';"];
Is it possible?
This is a image showing the problem:
Thank you so much for your responses. And sorry for my level, I am new and I am learning programming.